114 lines
3.6 KiB
TypeScript
114 lines
3.6 KiB
TypeScript
import {
|
|
Entity,
|
|
PrimaryColumn,
|
|
Column,
|
|
ManyToOne,
|
|
OneToMany,
|
|
JoinColumn,
|
|
} from 'typeorm';
|
|
import { Edificio } from '../../edificio/entities/edificio.entity';
|
|
import { Adscripcion } from '../../adscripcion/entities/adscripcion.entity';
|
|
import { Categoria } from '../../categoria/entities/categoria.entity';
|
|
import { DatosAcademicos } from '../../datos_academicos/entities/datos_academicos.entity';
|
|
import { LineasInvestigacion } from '../../lineas_investigacion/entities/lineas_investigacion.entity';
|
|
import { ProyectosAcademicos } from '../../proyectos_academicos/entities/proyectos_academicos.entity';
|
|
import { User } from 'src/users/entities/user.entity';
|
|
|
|
@Entity({ name: 'profesor' })
|
|
export class Profesor {
|
|
@PrimaryColumn({ type: 'int', nullable: false })
|
|
id_profesor: number;
|
|
|
|
@Column({ type: 'int', nullable: false })
|
|
id_usuario: number;
|
|
|
|
@Column({ type: 'varchar', length: 10, nullable: true })
|
|
num_trabajador: string;
|
|
|
|
@Column({ type: 'varchar', length: 80, nullable: false })
|
|
nombre: string;
|
|
|
|
@Column({ type: 'varchar', length: 10, nullable: true })
|
|
rfc: string;
|
|
|
|
@Column({ type: 'varchar', length: 3, nullable: true })
|
|
homoclave: string;
|
|
|
|
@Column({ type: 'varchar', length: 13, nullable: true })
|
|
tel_oficina: string;
|
|
|
|
@Column({ type: 'varchar', length: 10, nullable: true })
|
|
extension: string;
|
|
|
|
@Column({ type: 'varchar', length: 13, nullable: true })
|
|
tel_personal: string;
|
|
|
|
@Column({ type: 'varchar', length: 65, nullable: true })
|
|
correo_pcp: string;
|
|
|
|
@Column({ type: 'varchar', length: 65, nullable: true })
|
|
correo_per: string;
|
|
|
|
@Column({ type: 'int', nullable: true })
|
|
id_adscripcion: number;
|
|
|
|
@Column({ type: 'int', nullable: true })
|
|
id_categoria: number;
|
|
|
|
@Column({ type: 'int', nullable: true })
|
|
id_edificio: number;
|
|
|
|
@Column({ type: 'varchar', length: 256, nullable: true })
|
|
ubicacion: string;
|
|
|
|
@Column({ type: 'varchar', length: 150, nullable: true })
|
|
fotografia: string;
|
|
|
|
@Column({ type: 'boolean', nullable: false, default: false })
|
|
activo: boolean;
|
|
|
|
@Column({ type: 'boolean', nullable: false, default: true })
|
|
mostrar: boolean;
|
|
|
|
@Column({
|
|
type: 'timestamp',
|
|
nullable: false,
|
|
default: () => 'CURRENT_TIMESTAMP',
|
|
})
|
|
fecha_alta: Date;
|
|
|
|
@Column({
|
|
type: 'timestamp',
|
|
nullable: false,
|
|
default: () => 'CURRENT_TIMESTAMP',
|
|
onUpdate: 'CURRENT_TIMESTAMP',
|
|
})
|
|
fecha_actualizacion: Date;
|
|
|
|
@ManyToOne(() => Edificio, edificio => edificio.profesores)
|
|
@JoinColumn({ name: 'id_edificio', referencedColumnName: 'id_edificio', foreignKeyConstraintName: 'FK_edificio_fk' })
|
|
edificio: Edificio;
|
|
|
|
@ManyToOne(() => Adscripcion, adscripcion => adscripcion.profesores)
|
|
@JoinColumn({ name: 'id_adscripcion', referencedColumnName: 'id_adscripcion', foreignKeyConstraintName: 'FK_adscripcion_fk' })
|
|
adscripcion: Adscripcion;
|
|
|
|
@ManyToOne(() => Categoria, categoria => categoria.profesores)
|
|
@JoinColumn({ name: 'id_categoria', referencedColumnName: 'id_categoria', foreignKeyConstraintName: 'FK_categoria_fk' })
|
|
categoria: Categoria;
|
|
|
|
@ManyToOne(() => User, user => user.profesores)
|
|
@JoinColumn({ name: 'id_usuario', referencedColumnName: 'id_usuario', foreignKeyConstraintName: 'FK_usuario_fk' })
|
|
user: User;
|
|
|
|
@OneToMany(() => DatosAcademicos, datosAcademicos => datosAcademicos.profesor,{ cascade: true })
|
|
datosAcademicos: DatosAcademicos[];
|
|
|
|
@OneToMany(() => LineasInvestigacion, linea => linea.profesor,{ cascade: true })
|
|
lineasInvestigacion: LineasInvestigacion[];
|
|
|
|
@OneToMany(() => ProyectosAcademicos, proyecto => proyecto.profesor,{ cascade: true })
|
|
proyectosAcademicos: ProyectosAcademicos[];
|
|
|
|
}
|