43 lines
1.0 KiB
TypeScript
43 lines
1.0 KiB
TypeScript
import {
|
|
Entity,
|
|
Column,
|
|
PrimaryGeneratedColumn,
|
|
ManyToOne,
|
|
JoinColumn,
|
|
OneToMany,
|
|
} from 'typeorm';
|
|
import { Carrera } from './carreras.entity';
|
|
import { TipoUsuarioEntity } from './tipoUsuario.entity';
|
|
import { ComentarioEje } from './comentarioEjes.entity';
|
|
|
|
@Entity('usuarios')
|
|
export class UsuarioEntity {
|
|
@PrimaryGeneratedColumn('increment', { type: 'bigint' })
|
|
id: number;
|
|
|
|
@Column('text')
|
|
numero_identificacion: string;
|
|
|
|
@Column('text')
|
|
fecha_nacimiento: string;
|
|
|
|
@Column('text', { nullable: true })
|
|
rfc: string;
|
|
|
|
@Column({ name: 'tipo_usuario_id' })
|
|
tipo_usuario_id: number;
|
|
|
|
@ManyToOne(() => Carrera, (carrera) => carrera.usuarios, { nullable: true })
|
|
@JoinColumn({ name: 'carrera_id' })
|
|
carrera: Carrera;
|
|
|
|
@ManyToOne(() => TipoUsuarioEntity, (tipoUsuario) => tipoUsuario.usuarios, {
|
|
nullable: true,
|
|
})
|
|
@JoinColumn({ name: 'tipo_usuario_id' })
|
|
tipoUsuario: TipoUsuarioEntity;
|
|
|
|
@OneToMany(() => ComentarioEje, (comentarioEje) => comentarioEje.usuario)
|
|
comentarios: ComentarioEje[];
|
|
}
|