find dna by id root
This commit is contained in:
parent
7eea4cd33c
commit
926bbc1fda
1 changed files with 82 additions and 0 deletions
|
|
@ -174,6 +174,88 @@ export class OrganizationController extends Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API สร้างแบบร่างโครงสร้าง
|
||||||
|
*
|
||||||
|
* @summary ORG_022 - สร้างโครงสร้างใหม่ #23
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Post("finddna")
|
||||||
|
async FindDnaOrg(
|
||||||
|
@Body()
|
||||||
|
requestBody: {
|
||||||
|
root: string[] | null;
|
||||||
|
child1: string[] | null;
|
||||||
|
child2: string[] | null;
|
||||||
|
child3: string[] | null;
|
||||||
|
child4: string[] | null;
|
||||||
|
privilege: string;
|
||||||
|
},
|
||||||
|
@Request() request: RequestWithUser,
|
||||||
|
) {
|
||||||
|
const _data = [];
|
||||||
|
if (requestBody.root != null && requestBody.root.length > 0) {
|
||||||
|
for (const x of requestBody.root) {
|
||||||
|
const data = await this.orgRootRepository.findOne({
|
||||||
|
where: { id: x },
|
||||||
|
});
|
||||||
|
if (data) {
|
||||||
|
_data.push(data.ancestorDNA);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
requestBody.root = _data;
|
||||||
|
}
|
||||||
|
const _data1 = [];
|
||||||
|
if (requestBody.child1 != null && requestBody.child1.length > 0) {
|
||||||
|
for (const x of requestBody.child1) {
|
||||||
|
const data = await this.child1Repository.findOne({
|
||||||
|
where: { id: x },
|
||||||
|
});
|
||||||
|
if (data) {
|
||||||
|
_data1.push(data.ancestorDNA);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
requestBody.child1 = _data1;
|
||||||
|
}
|
||||||
|
const _data2 = [];
|
||||||
|
if (requestBody.child2 != null && requestBody.child2.length > 0) {
|
||||||
|
for (const x of requestBody.child2) {
|
||||||
|
const data = await this.child2Repository.findOne({
|
||||||
|
where: { id: x },
|
||||||
|
});
|
||||||
|
if (data) {
|
||||||
|
_data2.push(data.ancestorDNA);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
requestBody.child2 = _data2;
|
||||||
|
}
|
||||||
|
const _data3 = [];
|
||||||
|
if (requestBody.child3 != null && requestBody.child3.length > 0) {
|
||||||
|
for (const x of requestBody.child3) {
|
||||||
|
const data = await this.child3Repository.findOne({
|
||||||
|
where: { id: x },
|
||||||
|
});
|
||||||
|
if (data) {
|
||||||
|
_data3.push(data.ancestorDNA);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
requestBody.child3 = _data3;
|
||||||
|
}
|
||||||
|
const _data4 = [];
|
||||||
|
if (requestBody.child4 != null && requestBody.child4.length > 0) {
|
||||||
|
for (const x of requestBody.child4) {
|
||||||
|
const data = await this.child4Repository.findOne({
|
||||||
|
where: { id: x },
|
||||||
|
});
|
||||||
|
if (data) {
|
||||||
|
_data4.push(data.ancestorDNA);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
requestBody.child4 = _data4;
|
||||||
|
}
|
||||||
|
return new HttpSuccess(requestBody);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API เช็คสถานะโครงสร้างว่าส่งคนไปออกคำสั่งหรือไม่
|
* API เช็คสถานะโครงสร้างว่าส่งคนไปออกคำสั่งหรือไม่
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue