22 lines
576 B
TypeScript
22 lines
576 B
TypeScript
|
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[];
|
||
|
}
|