hrms-api-org/src/entities/Province.ts
2025-12-07 13:51:01 +07:00

42 lines
935 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;
// @Column({
// comment: "mark",
// default: null,
// })
// importUpdate: number;
// @Column({
// comment: "refId",
// default: null,
// })
// refId: number;
@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>;