แก้apiข้อมูลหลัก
This commit is contained in:
parent
73e07dfed6
commit
6b78a365fa
26 changed files with 1816 additions and 988 deletions
45
src/entities/SubDistrict.ts
Normal file
45
src/entities/SubDistrict.ts
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { District } from "./District";
|
||||
|
||||
@Entity("subDistrict")
|
||||
export class SubDistrict extends EntityBase {
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "แขวง",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
name: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "รหัสไปรษณีย์",
|
||||
length: 10,
|
||||
default: null,
|
||||
})
|
||||
zipCode: string;
|
||||
|
||||
@Column({
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง district",
|
||||
})
|
||||
districtId: string;
|
||||
|
||||
@ManyToOne(() => District, (district) => district.subDistricts)
|
||||
@JoinColumn({ name: "districtId" })
|
||||
district: District;
|
||||
|
||||
@OneToMany(() => SubDistrict, (subDistrict) => subDistrict.registrationSubDistricts)
|
||||
registrationSubDistricts: SubDistrict[];
|
||||
|
||||
@OneToMany(() => SubDistrict, (subDistrict) => subDistrict.currentSubDistricts)
|
||||
currentSubDistricts: SubDistrict[];
|
||||
}
|
||||
|
||||
export class CreateSubDistrict {
|
||||
@Column()
|
||||
name: string;
|
||||
}
|
||||
|
||||
export type UpdateSubDistrict = Partial<CreateSubDistrict>;
|
||||
Loading…
Add table
Add a link
Reference in a new issue