hrms-api-development/src/entities/Province.ts

28 lines
728 B
TypeScript

import { Entity, Column, OneToMany, ManyToMany, JoinTable } from "typeorm";
import { EntityBase } from "./base/Base";
import { Development } from "./Development";
@Entity("province")
export class Province extends EntityBase {
@Column({
nullable: true,
comment: "จังหวัด",
length: 255,
default: null,
})
name: string;
@ManyToMany(() => Development, (development) => development.provinces)
@JoinTable()
developmentProvinces: Development[];
@OneToMany(() => Development, (development: Development) => development.provinceActual)
developmentActuals: Development[];
}
export class CreateProvince {
@Column()
name: string;
}
export type UpdateProvince = Partial<CreateProvince>;