hrms-api-org/src/entities/Province.ts
2024-03-26 23:07:55 +07:00

30 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>;