members-database/entities/city.ts
2024-08-19 12:47:10 +02:00

25 lines
654 B
TypeScript

import { Column, Entity, OneToMany, PrimaryColumn } from "typeorm";
import { member } from "./member";
import { city_district } from "./city_district";
@Entity()
export class city {
@PrimaryColumn({ generated: "uuid", type: "varchar", length: 36 })
id: string;
@Column({ type: "varchar", length: 255, unique: true })
postal_code: string;
@Column({ type: "varchar", length: 255 })
city: string;
@OneToMany(() => city_district, (district) => district.city, {
onDelete: "RESTRICT",
})
districts: city_district[];
@OneToMany(() => member, (member) => member.city_district, {
onDelete: "RESTRICT",
})
members: member[];
}