Files
pcpuma_unam_api/src/operador/entity/operador.entity.ts
T
2022-10-23 17:52:46 -05:00

61 lines
1.7 KiB
TypeScript

import {
Column,
Entity,
JoinColumn,
ManyToOne,
OneToMany,
PrimaryGeneratedColumn,
} from 'typeorm';
import { Institucion } from '../../institucion/entity/institucion.entity';
import { EquipoMotivo } from '../../equipo-motivo/entity/equipo-motivo.entity';
import { Multa } from '../../multa/entity/multa.entity';
import { Prestamo } from '../../prestamo/entity/prestamo.entity';
import { TipoUsuario } from '../../tipo-usuario/entity/tipo-usuario.entity';
@Entity()
export class Operador {
@PrimaryGeneratedColumn()
id_operador: number;
@Column({ type: Boolean, nullable: false, default: false })
activo: boolean;
@Column({ type: String, nullable: true, length: 80 })
correo: string;
@Column({ type: String, nullable: true, length: 100 })
nombre: string;
@Column({ type: String, nullable: false, length: 40 })
operador: string;
@Column({ type: String, nullable: false, length: 60 })
password: string;
@Column({ type: Number, nullable: true })
id_institucion: number;
@Column({ type: Number, nullable: true })
id_tipo_usuario: number;
@ManyToOne(() => Institucion, (institucion) => institucion.operadores)
@JoinColumn({ name: 'id_institucion' })
institucion: Institucion;
@ManyToOne(() => TipoUsuario, (tipoUsuario) => tipoUsuario.operadores)
@JoinColumn({ name: 'id_tipo_usuario' })
tipoUsuario: TipoUsuario;
@OneToMany(() => EquipoMotivo, (motivo) => motivo.operador)
motivos: EquipoMotivo[];
@OneToMany(() => Multa, (multa) => multa.operadorMulta)
multas: Multa[];
@OneToMany(() => Prestamo, (prestamo) => prestamo.operadorEntrega)
prestamosOperadorEntrega: Prestamo[];
@OneToMany(() => Prestamo, (prestamo) => prestamo.operadorRegreso)
prestamosOperadorRegreso: Prestamo[];
}