แก้apiแสดงข้อมูลtree
This commit is contained in:
parent
49c468f53d
commit
9166faf102
6 changed files with 486 additions and 144 deletions
|
|
@ -97,7 +97,7 @@ export class OrgRootController extends Controller {
|
|||
}
|
||||
|
||||
const chkCode = await this.orgRootRepository.findOne({
|
||||
where: { orgRevisionId: requestBody.orgRevisionId , orgRootCode: requestBody.orgRootCode },
|
||||
where: { orgRevisionId: requestBody.orgRevisionId, orgRootCode: requestBody.orgRootCode },
|
||||
});
|
||||
if (chkCode != null) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "รหัสหน่วยงานนี้มีอยู่ในระบบแล้ว");
|
||||
|
|
@ -176,7 +176,7 @@ export class OrgRootController extends Controller {
|
|||
}
|
||||
|
||||
const chkCode = await this.orgRootRepository.findOne({
|
||||
where: { orgRevisionId: requestBody.orgRevisionId , orgRootCode: requestBody.orgRootCode },
|
||||
where: { orgRevisionId: requestBody.orgRevisionId, orgRootCode: requestBody.orgRootCode },
|
||||
});
|
||||
if (chkCode?.id != id && chkCode != null) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "รหัสหน่วยงานนี้มีอยู่ในระบบแล้ว");
|
||||
|
|
@ -184,7 +184,10 @@ export class OrgRootController extends Controller {
|
|||
|
||||
const orgRoot = await this.orgRootRepository.findOne({ where: { id } });
|
||||
if (!orgRoot) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลโครงสร้างระดับ Root ตามไอดีนี้ :" + id);
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่พบข้อมูลโครงสร้างระดับ Root ตามไอดีนี้ :" + id,
|
||||
);
|
||||
}
|
||||
try {
|
||||
orgRoot.lastUpdateUserId = request.user.sub;
|
||||
|
|
@ -210,7 +213,10 @@ export class OrgRootController extends Controller {
|
|||
async delete(@Path() id: string) {
|
||||
const orgRoot = await this.orgRootRepository.findOne({ where: { id } });
|
||||
if (!orgRoot) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลโครงสร้างระดับ Root ตามไอดีนี้ :" + id);
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่พบข้อมูลโครงสร้างระดับ Root ตามไอดีนี้ :" + id,
|
||||
);
|
||||
}
|
||||
|
||||
const orgChild1 = await this.orgChild1Repository.findOne({ where: { orgRootId: id } });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue