Files
api_directorio/src/users/entities/user.entity.ts
T
TioSam77 434cc05a06 S4
2024-06-18 15:21:12 -06:00

39 lines
1.1 KiB
TypeScript

import { Entity, PrimaryColumn, Column, ManyToOne, JoinColumn, OneToMany } from 'typeorm';
import { TipoUsuario } from "../../tipo_usuario/entities/tipo_usuario.entity";
import { Profesor } from 'src/Profesor/entities/profesor.entity';
@Entity({ name: 'usuario' })
export class User {
@PrimaryColumn({ type: 'int', nullable: false })
id_usuario: number;
@Column({ type: 'int', nullable: false })
id_tipo_usuario: number;
@Column({ type: 'varchar', length: 60, nullable: false })
correo: string;
@Column({ type: 'varchar', length: 60, nullable: false })
usuario: string;
@Column({ type: 'varchar', length: 60, nullable: false })
contraseña: string;
@Column({ type: 'varchar', length: 255, nullable: true })
jwt: string;
@Column({ type: 'datetime', nullable: true })
expirationjwt: Date;
@Column({ type: 'datetime', nullable: true })
lastlog: Date;
@ManyToOne(() => TipoUsuario, tipoUsuario => tipoUsuario.users)
@JoinColumn({ name: 'id_tipo_usuario' })
tipoUsuario: TipoUsuario;
@OneToMany(() => Profesor, profesor => profesor.user)
profesores: Profesor[];
}