import { Column, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn, } from "typeorm"; import { Partner, RequestLocal } from ".."; @Entity({ comment: "Con esta tabla podemos llevar el control de cambios qué se le han realizado al pedido.", name: "request_local_history", }) export class RequestLocalHistory { @PrimaryGeneratedColumn({ type: "int", comment: "ID único de cada registro.", }) id: number; @ManyToOne( () => RequestLocal, (requestLocal) => requestLocal.requests_local_history, { onDelete: "CASCADE", onUpdate: "NO ACTION", }, ) @JoinColumn({ name: "request_local" }) request_local: RequestLocal; @Column({ type: "int", width: 1, comment: "Estado en el que se encuentra el registro.", }) status: number; @Column({ length: 600, type: "varchar", nullable: true, default: null, comment: "Comentarios del cambio de estado del registro.", }) comment: string | null; @ManyToOne(() => Partner, (partner) => partner.updated_by_history, { onDelete: "CASCADE", onUpdate: "NO ACTION", nullable: true, }) @JoinColumn({ name: "updated_by" }) updated_by: Partner | null; @Column({ type: "datetime", comment: "Fecha en la que realizó el cambio.", default: () => "CURRENT_TIMESTAMP", onUpdate: "CURRENT_TIMESTAMP", }) updated: Date; }