Files
api_directorio/src/users/entities/user.entity.ts
T

39 lines
1.1 KiB
TypeScript
Raw Normal View History

2024-06-18 15:21:12 -06:00
import { Entity, PrimaryColumn, Column, ManyToOne, JoinColumn, OneToMany } from 'typeorm';
2024-06-17 20:19:58 -06:00
import { TipoUsuario } from "../../tipo_usuario/entities/tipo_usuario.entity";
2024-06-18 15:21:12 -06:00
import { Profesor } from 'src/Profesor/entities/profesor.entity';
2024-06-06 20:32:46 -06:00
2024-06-17 00:59:28 -06:00
@Entity({ name: 'usuario' })
2024-06-06 20:32:46 -06:00
export class User {
2024-06-18 13:14:31 -06:00
@PrimaryColumn({ type: 'int', nullable: false })
2024-06-17 00:59:28 -06:00
id_usuario: number;
2024-06-06 20:32:46 -06:00
2024-06-17 00:59:28 -06:00
@Column({ type: 'int', nullable: false })
id_tipo_usuario: number;
@Column({ type: 'varchar', length: 60, nullable: false })
2024-06-16 16:54:06 -06:00
correo: string;
2024-06-17 00:59:28 -06:00
@Column({ type: 'varchar', length: 60, nullable: false })
2024-06-16 16:54:06 -06:00
usuario: string;
2024-06-17 00:59:28 -06:00
@Column({ type: 'varchar', length: 60, nullable: false })
2024-06-16 16:54:06 -06:00
contraseña: string;
2024-06-11 02:31:33 -06:00
2024-06-17 00:59:28 -06:00
@Column({ type: 'varchar', length: 255, nullable: true })
jwt: string;
2024-06-11 02:32:29 -06:00
2024-06-17 00:59:28 -06:00
@Column({ type: 'datetime', nullable: true })
2024-06-11 15:14:05 -06:00
expirationjwt: Date;
2024-06-17 00:59:28 -06:00
@Column({ type: 'datetime', nullable: true })
2024-06-11 15:14:05 -06:00
lastlog: Date;
2024-06-17 00:59:28 -06:00
2024-06-17 11:41:50 -06:00
@ManyToOne(() => TipoUsuario, tipoUsuario => tipoUsuario.users)
@JoinColumn({ name: 'id_tipo_usuario' })
tipoUsuario: TipoUsuario;
2024-06-18 15:21:12 -06:00
@OneToMany(() => Profesor, profesor => profesor.user)
profesores: Profesor[];
2024-06-06 20:32:46 -06:00
}