import { Column, Entity, JoinColumn, ManyToOne, OneToMany, PrimaryGeneratedColumn, } from "typeorm"; import { City } from "./City"; import { Country } from "./Country"; @Entity({ comment: "Regiones/departamentos donde estará visible la plataforma.", }) export class Region { @PrimaryGeneratedColumn({ type: "int", comment: "Número de identificación (ID) único de cada registro.", }) id: number; @ManyToOne(() => Country, (country) => country.regions, { onDelete: "RESTRICT", onUpdate: "NO ACTION", }) @JoinColumn({ name: "country" }) country: Country; @Column({ length: 50, type: "varchar", comment: "Nombre de la región/departamento/estado.\r\n\r\nID/KEY de la variable que se encuentra en los archivos `locales` para el multilenguaje.", }) name: string; @Column({ default: 1, type: "int", width: 1, comment: "Estado del registro, es decir:\r\n1. Activo: Es visible en la plataforma.\r\n0. Inactivo: No será visible en la plataforma.", }) status: number; @OneToMany(() => City, (city) => city.region) cities: City[]; }