แก้ชื่อ tag
This commit is contained in:
parent
4b4f2423fa
commit
f509e10f8c
9 changed files with 151 additions and 107 deletions
|
|
@ -159,6 +159,14 @@ export class OrgChild1Controller {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found. RootId");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found. RootId");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const validOrgChild1Ranks = ["OFFICE", "DIVISION", "SECTION"];
|
||||||
|
if (
|
||||||
|
requestBody.orgChild1Rank == null ||
|
||||||
|
!validOrgChild1Ranks.includes(requestBody.orgChild1Rank.toUpperCase())
|
||||||
|
) {
|
||||||
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found. orgChild2Rank");
|
||||||
|
}
|
||||||
|
|
||||||
const child1 = await this.child1Repository.findOne({ where: { id } });
|
const child1 = await this.child1Repository.findOne({ where: { id } });
|
||||||
if (!child1) {
|
if (!child1) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found.");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found.");
|
||||||
|
|
|
||||||
|
|
@ -13,21 +13,28 @@ import {
|
||||||
Body,
|
Body,
|
||||||
Request,
|
Request,
|
||||||
Example,
|
Example,
|
||||||
|
SuccessResponse,
|
||||||
|
Response,
|
||||||
} from "tsoa";
|
} from "tsoa";
|
||||||
import HttpStatusCode from "../interfaces/http-status";
|
import HttpStatusCode from "../interfaces/http-status";
|
||||||
import HttpSuccess from "../interfaces/http-success";
|
import HttpSuccess from "../interfaces/http-success";
|
||||||
import HttpError from "../interfaces/http-error";
|
import HttpError from "../interfaces/http-error";
|
||||||
import { CreateOrgChild2, OrgChild2 } from "../entities/OrgChild2";
|
import { CreateOrgChild2, OrgChild2, UpdateOrgChild2 } from "../entities/OrgChild2";
|
||||||
import { OrgChild1 } from "../entities/OrgChild1";
|
import { OrgChild1 } from "../entities/OrgChild1";
|
||||||
import { OrgChild3 } from "../entities/OrgChild3";
|
import { OrgChild3 } from "../entities/OrgChild3";
|
||||||
|
|
||||||
@Route("organization")
|
@Route("organization")
|
||||||
@Tags("OrgChild2")
|
@Tags("OrgChild2")
|
||||||
@Security("bearerAuth")
|
@Security("bearerAuth")
|
||||||
|
@Response(
|
||||||
|
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||||
|
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||||
|
)
|
||||||
|
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||||
export class OrgChild2Controller extends Controller {
|
export class OrgChild2Controller extends Controller {
|
||||||
private orgChild1Repository = AppDataSource.getRepository(OrgChild1);
|
private child1Repository = AppDataSource.getRepository(OrgChild1);
|
||||||
private orgChild2Repository = AppDataSource.getRepository(OrgChild2);
|
private child2Repository = AppDataSource.getRepository(OrgChild2);
|
||||||
private orgChild3Repository = AppDataSource.getRepository(OrgChild3);
|
private child3Repository = AppDataSource.getRepository(OrgChild3);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* สร้างโครงสร้างระดับ2 Child2
|
* สร้างโครงสร้างระดับ2 Child2
|
||||||
|
|
@ -35,7 +42,7 @@ export class OrgChild2Controller extends Controller {
|
||||||
* @summary ORG_007 - สร้างโครงสร้างระดับ2 (ADMIN) #7
|
* @summary ORG_007 - สร้างโครงสร้างระดับ2 (ADMIN) #7
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Post("child2")
|
@Post()
|
||||||
@Example([
|
@Example([
|
||||||
{
|
{
|
||||||
orgChild2Name: "string", //ชื่อหน่วยงาน
|
orgChild2Name: "string", //ชื่อหน่วยงาน
|
||||||
|
|
@ -45,7 +52,7 @@ export class OrgChild2Controller extends Controller {
|
||||||
orgChild2PhoneEx: "string", //หมายเลขโทรศัพท์ที่ติดต่อจากภายนอก
|
orgChild2PhoneEx: "string", //หมายเลขโทรศัพท์ที่ติดต่อจากภายนอก
|
||||||
orgChild2PhoneIn: "string", //หมายเลขโทรศัพท์ที่ติดต่อจากภายใน
|
orgChild2PhoneIn: "string", //หมายเลขโทรศัพท์ที่ติดต่อจากภายใน
|
||||||
orgChild2Fax: "string", //หมายเลขโทรสาร
|
orgChild2Fax: "string", //หมายเลขโทรสาร
|
||||||
orgChild2IsNormal: "boolean", //สถานะของหน่วยงาน
|
// orgChild2IsNormal: "boolean", //สถานะของหน่วยงาน
|
||||||
orgChild1Id: "Guid", //id Child1
|
orgChild1Id: "Guid", //id Child1
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
@ -55,24 +62,28 @@ export class OrgChild2Controller extends Controller {
|
||||||
@Request() request: { user: Record<string, any> },
|
@Request() request: { user: Record<string, any> },
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
const orgChild1 = await this.orgChild1Repository.findOne({
|
//BE ใช้ orgChild1Id หา orgChild1Id, orgRootId
|
||||||
|
const child1 = await this.child1Repository.findOne({
|
||||||
where: { id: requestBody.orgChild1Id },
|
where: { id: requestBody.orgChild1Id },
|
||||||
});
|
});
|
||||||
const orgChild2 = Object.assign(new OrgChild2(), requestBody);
|
if (!child1) {
|
||||||
if (!orgChild2) {
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found.");
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (orgChild1) {
|
const validOrgChild2Ranks = ["OFFICE", "DIVISION", "SECTION"];
|
||||||
orgChild2.createdUserId = request.user.sub;
|
if (!validOrgChild2Ranks.includes(requestBody.orgChild2Rank.toUpperCase())) {
|
||||||
orgChild2.createdFullName = request.user.name;
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found. orgChild2Rank");
|
||||||
orgChild2.lastUpdateUserId = request.user.sub;
|
|
||||||
orgChild2.lastUpdateFullName = request.user.name;
|
|
||||||
await this.orgChild2Repository.save(orgChild2);
|
|
||||||
} else {
|
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดีโครงสร้างระดับ1");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const child2 = Object.assign(new OrgChild2(), requestBody) as OrgChild2;
|
||||||
|
child2.orgChild2Name = requestBody.orgChild2Name;
|
||||||
|
child2.createdUserId = request.user.sub;
|
||||||
|
child2.createdFullName = request.user.name;
|
||||||
|
child2.lastUpdateUserId = request.user.sub;
|
||||||
|
child2.lastUpdateFullName = request.user.name;
|
||||||
|
child2.orgRootId = String(child1?.orgRootId);
|
||||||
|
child2.orgChild1Id = String(child1?.id);
|
||||||
|
await this.child2Repository.save(child2);
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return error;
|
return error;
|
||||||
|
|
@ -96,33 +107,44 @@ export class OrgChild2Controller extends Controller {
|
||||||
orgChild2PhoneEx: "string", //หมายเลขโทรศัพท์ที่ติดต่อจากภายนอก
|
orgChild2PhoneEx: "string", //หมายเลขโทรศัพท์ที่ติดต่อจากภายนอก
|
||||||
orgChild2PhoneIn: "string", //หมายเลขโทรศัพท์ที่ติดต่อจากภายใน
|
orgChild2PhoneIn: "string", //หมายเลขโทรศัพท์ที่ติดต่อจากภายใน
|
||||||
orgChild2Fax: "string", //หมายเลขโทรสาร
|
orgChild2Fax: "string", //หมายเลขโทรสาร
|
||||||
orgChild2IsNormal: "boolean", //สถานะของหน่วยงาน
|
// orgChild2IsNormal: "boolean", //สถานะของหน่วยงาน
|
||||||
orgChild1Id: "Guid", //id Child1
|
orgChild1Id: "Guid", //id Child1
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
async update(
|
async update(
|
||||||
@Path() id: string,
|
@Path() id: string,
|
||||||
@Body()
|
@Body()
|
||||||
requestBody: CreateOrgChild2,
|
requestBody: UpdateOrgChild2,
|
||||||
@Request() request: { user: Record<string, any> },
|
@Request() request: { user: Record<string, any> },
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
const orgChild1 = await this.orgChild1Repository.findOne({
|
const child1IdExits = await this.child1Repository.findOne({
|
||||||
where: { id: requestBody.orgChild1Id },
|
where: { id: requestBody.orgChild1Id },
|
||||||
});
|
});
|
||||||
const orgChild2 = await this.orgChild2Repository.findOne({ where: { id } });
|
if (!child1IdExits) {
|
||||||
if (!orgChild2) {
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found. Child1Id");
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (orgChild1) {
|
const validOrgChild2Ranks = ["OFFICE", "DIVISION", "SECTION"];
|
||||||
orgChild2.lastUpdateUserId = request.user.sub;
|
if (
|
||||||
orgChild2.lastUpdateFullName = request.user.name;
|
requestBody.orgChild2Rank == null ||
|
||||||
orgChild2.lastUpdatedAt = new Date();
|
!validOrgChild2Ranks.includes(requestBody.orgChild2Rank.toUpperCase())
|
||||||
await this.orgChild2Repository.save(orgChild2);
|
) {
|
||||||
} else {
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found. orgChild2Rank");
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดีโครงสร้างระดับ1");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const child2 = await this.child2Repository.findOne({ where: { id } });
|
||||||
|
if (!child2) {
|
||||||
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found.");
|
||||||
|
}
|
||||||
|
|
||||||
|
child2.lastUpdateUserId = request.user.sub;
|
||||||
|
child2.lastUpdateFullName = request.user.name;
|
||||||
|
child2.lastUpdatedAt = new Date();
|
||||||
|
child2.orgRootId = String(child1IdExits?.orgRootId);
|
||||||
|
child2.orgChild1Id = String(child1IdExits?.id);
|
||||||
|
this.child2Repository.merge(child2, requestBody);
|
||||||
|
await this.child2Repository.save(child2);
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return error;
|
return error;
|
||||||
|
|
@ -139,22 +161,18 @@ export class OrgChild2Controller extends Controller {
|
||||||
@Delete("Child2/{id}")
|
@Delete("Child2/{id}")
|
||||||
async delete(@Path() id: string) {
|
async delete(@Path() id: string) {
|
||||||
try {
|
try {
|
||||||
const orgChild2 = await this.orgChild2Repository.findOne({ where: { id } });
|
const child2 = await this.child2Repository.findOne({ where: { id } });
|
||||||
const orgChild3 = await this.orgChild3Repository.findOne({ where: { orgChild2Id: id } });
|
if (!child2) {
|
||||||
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found.");
|
||||||
if (!orgChild2) {
|
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
|
||||||
}
|
}
|
||||||
|
const exitsChild3 = await this.child3Repository.findOne({ where: { orgChild2Id: id } });
|
||||||
if (!orgChild3) {
|
if (exitsChild3) {
|
||||||
await this.orgChild2Repository.remove(orgChild2);
|
|
||||||
} else {
|
|
||||||
throw new HttpError(
|
throw new HttpError(
|
||||||
HttpStatusCode.NOT_FOUND,
|
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||||
"ไม่สามารถลบข้อมูลได้เมื่อมีข้อมูลโครงสร้างระดับ3",
|
"ไม่สามารถลบได้ เนื่องจาก id ผูกกับโครงสร้างระดับ4",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
await this.child2Repository.remove(child2);
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return error;
|
return error;
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,14 @@ export class OrgChild3Controller {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found. Child2Id");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found. Child2Id");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const validOrgChild3Ranks = ["OFFICE", "DIVISION", "SECTION"];
|
||||||
|
if (
|
||||||
|
requestBody.orgChild3Rank == null ||
|
||||||
|
!validOrgChild3Ranks.includes(requestBody.orgChild3Rank.toUpperCase())
|
||||||
|
) {
|
||||||
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found. orgChild2Rank");
|
||||||
|
}
|
||||||
|
|
||||||
const child3 = await this.child3Repository.findOne({ where: { id } });
|
const child3 = await this.child3Repository.findOne({ where: { id } });
|
||||||
if (!child3) {
|
if (!child3) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found.");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found.");
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ export class OrgChild4Controller extends Controller {
|
||||||
orgChild4PhoneEx: "string", //หมายเลขโทรศัพท์ที่ติดต่อจากภายนอก
|
orgChild4PhoneEx: "string", //หมายเลขโทรศัพท์ที่ติดต่อจากภายนอก
|
||||||
orgChild4PhoneIn: "string", //หมายเลขโทรศัพท์ที่ติดต่อจากภายใน
|
orgChild4PhoneIn: "string", //หมายเลขโทรศัพท์ที่ติดต่อจากภายใน
|
||||||
orgChild4Fax: "string", //หมายเลขโทรสาร
|
orgChild4Fax: "string", //หมายเลขโทรสาร
|
||||||
orgChild4IsNormal: "boolean", //สถานะของหน่วยงาน
|
// orgChild4IsNormal: "boolean", //สถานะของหน่วยงาน
|
||||||
orgChild3Id: "Guid", //id Child1
|
orgChild3Id: "Guid", //id Child1
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
@ -109,7 +109,7 @@ export class OrgChild4Controller extends Controller {
|
||||||
orgChild4PhoneEx: "string", //หมายเลขโทรศัพท์ที่ติดต่อจากภายนอก
|
orgChild4PhoneEx: "string", //หมายเลขโทรศัพท์ที่ติดต่อจากภายนอก
|
||||||
orgChild4PhoneIn: "string", //หมายเลขโทรศัพท์ที่ติดต่อจากภายใน
|
orgChild4PhoneIn: "string", //หมายเลขโทรศัพท์ที่ติดต่อจากภายใน
|
||||||
orgChild4Fax: "string", //หมายเลขโทรสาร
|
orgChild4Fax: "string", //หมายเลขโทรสาร
|
||||||
orgChild4IsNormal: "boolean", //สถานะของหน่วยงาน
|
// orgChild4IsNormal: "boolean", //สถานะของหน่วยงาน
|
||||||
orgChild3Id: "Guid", //id Child1
|
orgChild3Id: "Guid", //id Child1
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
@ -127,6 +127,14 @@ export class OrgChild4Controller extends Controller {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found. Child3Id");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found. Child3Id");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const validOrgChild4Ranks = ["OFFICE", "DIVISION", "SECTION"];
|
||||||
|
if (
|
||||||
|
requestBody.orgChild4Rank == null ||
|
||||||
|
!validOrgChild4Ranks.includes(requestBody.orgChild4Rank.toUpperCase())
|
||||||
|
) {
|
||||||
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found. orgChild2Rank");
|
||||||
|
}
|
||||||
|
|
||||||
const child4 = await this.child4Repository.findOne({ where: { id } });
|
const child4 = await this.child4Repository.findOne({ where: { id } });
|
||||||
if (!child4) {
|
if (!child4) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found.");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found.");
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ enum OrgChild1Rank {
|
||||||
|
|
||||||
@Entity("orgChild1")
|
@Entity("orgChild1")
|
||||||
export class OrgChild1 extends EntityBase {
|
export class OrgChild1 extends EntityBase {
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
comment: "ชื่อส่วนราชการ",
|
comment: "ชื่อส่วนราชการ",
|
||||||
|
|
@ -75,7 +74,7 @@ export class OrgChild1 extends EntityBase {
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
comment: "สถานะของหน่วยงาน",
|
comment: "สถานะของหน่วยงาน",
|
||||||
default: true
|
default: true,
|
||||||
})
|
})
|
||||||
orgChild1IsNormal: boolean;
|
orgChild1IsNormal: boolean;
|
||||||
|
|
||||||
|
|
@ -91,17 +90,15 @@ export class OrgChild1 extends EntityBase {
|
||||||
})
|
})
|
||||||
isAncestorDNA: string;
|
isAncestorDNA: string;
|
||||||
|
|
||||||
@ManyToOne(() => OrgRoot, orgRoot => orgRoot.orgChild1s)
|
@ManyToOne(() => OrgRoot, (orgRoot) => orgRoot.orgChild1s)
|
||||||
@JoinColumn({ name: "orgRootId" })
|
@JoinColumn({ name: "orgRootId" })
|
||||||
orgRoot: OrgRoot;
|
orgRoot: OrgRoot;
|
||||||
|
|
||||||
@OneToMany(() => OrgChild2, orgChild2 => orgChild2.orgChild1)
|
@OneToMany(() => OrgChild2, (orgChild2) => orgChild2.orgChild1)
|
||||||
orgChild2s: OrgChild2[];
|
orgChild2s: OrgChild2[];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreateOrgChild1 {
|
export class CreateOrgChild1 {
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
orgChild1Name: string;
|
orgChild1Name: string;
|
||||||
|
|
||||||
|
|
@ -110,22 +107,21 @@ export class CreateOrgChild1 {
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
orgChild1Code?: string;
|
orgChild1Code?: string;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
orgChild1Rank: string;
|
orgChild1Rank: string;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
orgChild1PhoneEx: string;
|
orgChild1PhoneEx?: string;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
orgChild1PhoneIn: string;
|
orgChild1PhoneIn?: string;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
orgChild1Fax: string;
|
orgChild1Fax?: string;
|
||||||
|
|
||||||
@Column('uuid')
|
@Column("uuid")
|
||||||
orgRootId: string;
|
orgRootId: string;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UpdateOrgChild1 = Partial<CreateOrgChild1> & { orgChild1Rank?: OrgChild1Rank };
|
export type UpdateOrgChild1 = Partial<CreateOrgChild1> & { orgChild1Rank?: OrgChild1Rank };
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,12 @@ enum OrgChild2Rank {
|
||||||
}
|
}
|
||||||
@Entity("orgChild2")
|
@Entity("orgChild2")
|
||||||
export class OrgChild2 extends EntityBase {
|
export class OrgChild2 extends EntityBase {
|
||||||
// @Column({
|
// @Column({
|
||||||
// comment: "",
|
// comment: "",
|
||||||
// length: 40,
|
// length: 40,
|
||||||
// default: "00000000-0000-0000-0000-000000000000",
|
// default: "00000000-0000-0000-0000-000000000000",
|
||||||
// })
|
// })
|
||||||
// orgChild2Id: string;
|
// orgChild2Id: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
|
|
@ -84,7 +84,7 @@ export class OrgChild2 extends EntityBase {
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
comment: "สถานะของหน่วยงาน", //ปกติ = 1 , ยุกเลิก = 0
|
comment: "สถานะของหน่วยงาน", //ปกติ = 1 , ยุกเลิก = 0
|
||||||
default: true
|
default: true,
|
||||||
})
|
})
|
||||||
orgChild2IsNormal: boolean;
|
orgChild2IsNormal: boolean;
|
||||||
|
|
||||||
|
|
@ -106,17 +106,15 @@ export class OrgChild2 extends EntityBase {
|
||||||
})
|
})
|
||||||
isAncestorDNA: string;
|
isAncestorDNA: string;
|
||||||
|
|
||||||
@ManyToOne(() => OrgChild1, orgChild1 => orgChild1.orgChild2s)
|
@ManyToOne(() => OrgChild1, (orgChild1) => orgChild1.orgChild2s)
|
||||||
@JoinColumn({ name: "orgChild1Id" })
|
@JoinColumn({ name: "orgChild1Id" })
|
||||||
orgChild1: OrgChild1;
|
orgChild1: OrgChild1;
|
||||||
|
|
||||||
@OneToMany(() => OrgChild3, orgChild3 => orgChild3.orgChild2)
|
@OneToMany(() => OrgChild3, (orgChild3) => orgChild3.orgChild2)
|
||||||
orgChild3s: OrgChild3[];
|
orgChild3s: OrgChild3[];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreateOrgChild2 {
|
export class CreateOrgChild2 {
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
orgChild2Name: string;
|
orgChild2Name: string;
|
||||||
|
|
||||||
|
|
@ -125,21 +123,20 @@ export class CreateOrgChild2 {
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
orgChild2Code: string;
|
orgChild2Code: string;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
orgChild2Rank: string;
|
orgChild2Rank: string;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
orgChild2PhoneEx: string;
|
orgChild2PhoneEx?: string;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
orgChild2PhoneIn: string;
|
orgChild2PhoneIn?: string;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
orgChild2Fax: string;
|
orgChild2Fax?: string;
|
||||||
|
|
||||||
@Column('uuid')
|
@Column("uuid")
|
||||||
orgChild1Id: string;
|
orgChild1Id: string;
|
||||||
|
|
||||||
}
|
}
|
||||||
export type UpdateOrgChild2 = Partial<CreateOrgChild2>;
|
export type UpdateOrgChild2 = Partial<CreateOrgChild2> & { orgChild2Rank?: OrgChild2Rank };
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ enum OrgChild3Rank {
|
||||||
|
|
||||||
@Entity("orgChild3")
|
@Entity("orgChild3")
|
||||||
export class OrgChild3 extends EntityBase {
|
export class OrgChild3 extends EntityBase {
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
comment: "ชื่อส่วนราชการ",
|
comment: "ชื่อส่วนราชการ",
|
||||||
|
|
@ -75,7 +74,7 @@ export class OrgChild3 extends EntityBase {
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
comment: "สถานะของหน่วยงาน",
|
comment: "สถานะของหน่วยงาน",
|
||||||
default: true
|
default: true,
|
||||||
})
|
})
|
||||||
orgChild3IsNormal: boolean;
|
orgChild3IsNormal: boolean;
|
||||||
|
|
||||||
|
|
@ -103,17 +102,15 @@ export class OrgChild3 extends EntityBase {
|
||||||
})
|
})
|
||||||
isAncestorDNA: string;
|
isAncestorDNA: string;
|
||||||
|
|
||||||
@ManyToOne(() => OrgChild2, orgChild2 => orgChild2.orgChild3s)
|
@ManyToOne(() => OrgChild2, (orgChild2) => orgChild2.orgChild3s)
|
||||||
@JoinColumn({ name: "orgChild2Id" })
|
@JoinColumn({ name: "orgChild2Id" })
|
||||||
orgChild2: OrgChild2;
|
orgChild2: OrgChild2;
|
||||||
|
|
||||||
@OneToMany(() => OrgChild4, orgChild4 => orgChild4.orgChild3)
|
@OneToMany(() => OrgChild4, (orgChild4) => orgChild4.orgChild3)
|
||||||
orgChild4s: OrgChild4[];
|
orgChild4s: OrgChild4[];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreateOrgChild3 {
|
export class CreateOrgChild3 {
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
orgChild3Name: string;
|
orgChild3Name: string;
|
||||||
|
|
||||||
|
|
@ -122,22 +119,21 @@ export class CreateOrgChild3 {
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
orgChild3Code: string;
|
orgChild3Code: string;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
orgChild3Rank: string;
|
orgChild3Rank: string;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
orgChild3PhoneEx: string;
|
orgChild3PhoneEx?: string;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
orgChild3PhoneIn: string;
|
orgChild3PhoneIn?: string;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
orgChild3Fax: string;
|
orgChild3Fax?: string;
|
||||||
|
|
||||||
@Column('uuid')
|
@Column("uuid")
|
||||||
orgChild2Id: string;
|
orgChild2Id: string;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UpdateOrgChild3 = Partial<CreateOrgChild3> & { orgChild3Rank?: OrgChild3Rank };
|
export type UpdateOrgChild3 = Partial<CreateOrgChild3> & { orgChild3Rank?: OrgChild3Rank };
|
||||||
|
|
|
||||||
|
|
@ -13,12 +13,12 @@ enum OrgChild4Rank {
|
||||||
}
|
}
|
||||||
@Entity("orgChild4")
|
@Entity("orgChild4")
|
||||||
export class OrgChild4 extends EntityBase {
|
export class OrgChild4 extends EntityBase {
|
||||||
// @Column({
|
// @Column({
|
||||||
// comment: "",
|
// comment: "",
|
||||||
// length: 40,
|
// length: 40,
|
||||||
// default: "00000000-0000-0000-0000-000000000000",
|
// default: "00000000-0000-0000-0000-000000000000",
|
||||||
// })
|
// })
|
||||||
// orgChild4Id: string;
|
// orgChild4Id: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
|
|
@ -83,7 +83,7 @@ export class OrgChild4 extends EntityBase {
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
comment: "สถานะของหน่วยงาน", //ปกติ = 1 , ยุกเลิก = 0
|
comment: "สถานะของหน่วยงาน", //ปกติ = 1 , ยุกเลิก = 0
|
||||||
default: true
|
default: true,
|
||||||
})
|
})
|
||||||
orgChild4IsNormal: boolean;
|
orgChild4IsNormal: boolean;
|
||||||
|
|
||||||
|
|
@ -116,14 +116,13 @@ export class OrgChild4 extends EntityBase {
|
||||||
default: "00000000-0000-0000-0000-000000000000",
|
default: "00000000-0000-0000-0000-000000000000",
|
||||||
})
|
})
|
||||||
isAncestorDNA: string;
|
isAncestorDNA: string;
|
||||||
|
|
||||||
@ManyToOne(() => OrgChild3, orgChild3 => orgChild3.orgChild4s)
|
@ManyToOne(() => OrgChild3, (orgChild3) => orgChild3.orgChild4s)
|
||||||
@JoinColumn({ name: "orgChild3Id" })
|
@JoinColumn({ name: "orgChild3Id" })
|
||||||
orgChild3: OrgChild3;
|
orgChild3: OrgChild3;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreateOrgChild4 {
|
export class CreateOrgChild4 {
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
orgChild4Name: string;
|
orgChild4Name: string;
|
||||||
|
|
||||||
|
|
@ -132,21 +131,20 @@ export class CreateOrgChild4 {
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
orgChild4Code: string;
|
orgChild4Code: string;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
orgChild4Rank: string;
|
orgChild4Rank: string;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
orgChild4PhoneEx: string;
|
orgChild4PhoneEx?: string;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
orgChild4PhoneIn: string;
|
orgChild4PhoneIn?: string;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
orgChild4Fax: string;
|
orgChild4Fax?: string;
|
||||||
|
|
||||||
@Column('uuid')
|
@Column("uuid")
|
||||||
orgChild3Id: string;
|
orgChild3Id: string;
|
||||||
|
|
||||||
}
|
}
|
||||||
export type UpdateOrgChild4 = Partial<OrgChild4>;
|
export type UpdateOrgChild4 = Partial<OrgChild4>;
|
||||||
|
|
|
||||||
21
tsoa.json
21
tsoa.json
|
|
@ -26,9 +26,24 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
"name": "Test", "description": "ทดสอบ"
|
"name": "Organization", "description": "โครงสร้างส่วนอื่น ๆ"
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
"name": "OrgRoot", "description": "โครงสร้างระดับ root"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "OrgChild1", "description": "โครงสร้างระดับ 1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "OrgChild2", "description": "โครงสร้างระดับ 2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "OrgChild3", "description": "โครงสร้างระดับ 3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "OrgChild4", "description": "โครงสร้างระดับ 4"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"routes": {
|
"routes": {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue