members-database/entities/city_district.ts

22 lines
576 B
TypeScript
Raw Normal View History

2024-08-19 10:47:10 +00:00
import { Column, Entity, JoinColumn, ManyToOne, OneToMany, PrimaryColumn } from "typeorm";
import { member } from "./member";
import { city } from "./city";
@Entity()
export class city_district {
@PrimaryColumn({ generated: "uuid", type: "varchar", length: 36 })
id: string;
@Column({ type: "varchar", length: 255, unique: true, nullable: true })
district?: string;
@ManyToOne(() => city, (city) => city.districts)
@JoinColumn()
city: city;
@OneToMany(() => member, (member) => member.city_district, {
onDelete: "RESTRICT",
})
members: member[];
}