Files
dsc-api/src/modules/address/entities/city.entity.ts
T
2025-02-26 20:15:16 +03:30

20 lines
499 B
TypeScript
Executable File

import { Column, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
import { Address } from "./address.entity";
import { Province } from "./province.entity";
@Entity()
export class City {
@PrimaryGeneratedColumn()
id: number;
@Column({ type: "varchar", length: 255 })
name: string;
@OneToMany(() => Address, (address) => address.city)
addresses: Address[];
@ManyToOne(() => Province, (province) => province.cities, { nullable: false })
province: Province;
}