31 lines
747 B
TypeScript
31 lines
747 B
TypeScript
|
|
import { Entity, Column, OneToMany } from "typeorm";
|
||
|
|
import { EntityBase } from "./base/Base";
|
||
|
|
import { District } from "./District";
|
||
|
|
|
||
|
|
@Entity("province")
|
||
|
|
export class Province extends EntityBase {
|
||
|
|
@Column({
|
||
|
|
nullable: true,
|
||
|
|
comment: "จังหวัด",
|
||
|
|
length: 255,
|
||
|
|
default: null,
|
||
|
|
})
|
||
|
|
name: string;
|
||
|
|
|
||
|
|
@OneToMany(() => District, (district) => district.province)
|
||
|
|
districts: District[];
|
||
|
|
|
||
|
|
@OneToMany(() => Province, (province) => province.registrationProvinces)
|
||
|
|
registrationProvinces: Province[];
|
||
|
|
|
||
|
|
@OneToMany(() => Province, (province) => province.currentProvinces)
|
||
|
|
currentProvinces: Province[];
|
||
|
|
}
|
||
|
|
|
||
|
|
export class CreateProvince {
|
||
|
|
@Column()
|
||
|
|
name: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export type UpdateProvince = Partial<CreateProvince>;
|