Entidades y Realciones(Falta enrutar bien)
This commit is contained in:
@@ -1,12 +1,17 @@
|
||||
import { Entity, Column, PrimaryColumn, ManyToOne } from "typeorm";
|
||||
|
||||
import { Entity, PrimaryColumn, Column, ManyToOne, OneToMany, JoinColumn } from 'typeorm';
|
||||
import { Edificio } from './edificio.entity';
|
||||
import { Adscripcion } from './adscripcion.entity';
|
||||
import { Categoria } from './categoria.entity';
|
||||
import { DatosAcademicos } from './datos_academicos.entity';
|
||||
import { LineasInvestigacion } from './lineas_investigacion.entity';
|
||||
import { ProyectosAcademicos } from './proyectos_academicos.entity';
|
||||
|
||||
@Entity()
|
||||
export class Profesor {
|
||||
@PrimaryColumn({ type: 'int', length:11, nullable: false })
|
||||
@PrimaryColumn({ type: 'int', length: 11, nullable: false })
|
||||
id_profesor: number;
|
||||
|
||||
@Column({ type: 'int', length:11, nullable: false })
|
||||
@Column({ type: 'int', length: 11, nullable: false })
|
||||
id_usuario: number;
|
||||
|
||||
@Column({ type: 'varchar', length: 10, nullable: true })
|
||||
@@ -63,4 +68,24 @@ export class Profesor {
|
||||
@Column({ type: 'timestamp', nullable: false, default: () => 'CURRENT_TIMESTAMP', onUpdate: 'CURRENT_TIMESTAMP' })
|
||||
fecha_actualizacion: Date;
|
||||
|
||||
@ManyToOne(() => Edificio, edificio => edificio.profesores)
|
||||
@JoinColumn({ name: 'id_edificio' })
|
||||
edificio: Edificio;
|
||||
|
||||
@ManyToOne(() => Adscripcion, adscripcion => adscripcion.profesores)
|
||||
@JoinColumn({ name: 'id_adscripcion' })
|
||||
adscripcion: Adscripcion;
|
||||
|
||||
@ManyToOne(() => Categoria, categoria => categoria.profesores)
|
||||
@JoinColumn({ name: 'id_categoria' })
|
||||
categoria: Categoria;
|
||||
|
||||
@OneToMany(() => DatosAcademicos, datosAcademicos => DatosAcademicos.profesor)
|
||||
datosAcademicos: DatosAcademicos[];
|
||||
|
||||
@OneToMany(() => LineasInvestigacion, lineasInvestigacion => LineasInvestigacion.profesor)
|
||||
lineasInvestigacion: LineasInvestigacion[];
|
||||
|
||||
@OneToMany(() => ProyectosAcademicos, proyectosAcademicos => ProyectosAcademicos.profesor)
|
||||
proyectosAcademicos: ProyectosAcademicos[];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user