import { Column, Entity, JoinColumn, ManyToOne, OneToMany, PrimaryGeneratedColumn, } from "typeorm"; import { Local } from "./Local"; import { LocalReserve } from "./LocalReserve"; import { Partner } from "./Partner"; @Entity({ comment: "Tabla para agregar los estados y color que van a tener las reservas.", name: "local_reserve_status", }) export class LocalReserveStatus { @PrimaryGeneratedColumn({ type: "int", comment: "Id único de cada registro.", }) id: number; @ManyToOne(() => Local, (local) => local.local_reserve_status, { onDelete: "CASCADE", onUpdate: "NO ACTION", }) @JoinColumn({ name: "local" }) local: Local; @Column({ type: "varchar", length: 50, comment: "Nombre del estado para la reserva.", }) name: string; @Column({ type: "varchar", length: 200, comment: "Descripción del estado para la reserva.", nullable: true, default: null, }) description: string | null; @Column({ type: "varchar", length: 7, comment: "Color que va a tener el estado.", }) color: string; @Column({ type: "datetime", nullable: true, default: null, comment: "Fecha de actualización del registro.", onUpdate: "CURRENT_TIMESTAMP", }) updated: Date | null; @ManyToOne(() => Partner, (partner) => partner.local_reserve_status, { onDelete: "NO ACTION", onUpdate: "NO ACTION", nullable: true, }) @JoinColumn({ name: "updated_by" }) updated_by: Partner | null; @Column({ default: 1, type: "int", width: 1, comment: "Estado del estado de la reserva.\r\n0: Inactivo.\r\n1: Activo.", }) status: number; @OneToMany(() => LocalReserve, (localReserve) => localReserve.status) local_reserves: LocalReserve[]; }