no message

This commit is contained in:
Kittapath 2024-02-13 18:37:58 +07:00
parent 60b25c6620
commit d633e78058

View file

@ -1193,196 +1193,196 @@ export class PositionController extends Controller {
if (requestBody.isNode === true) {
switch (requestBody.type) {
case 0: {
const NodeId = await this.posMasterRepository.findOne({
where: { orgRootId: requestBody.id },
});
if (!NodeId) {
throw new HttpError(
HttpStatusCode.NOT_FOUND,
"ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id,
);
}
// const NodeId = await this.posMasterRepository.findOne({
// where: { orgRootId: requestBody.id },
// });
// if (!NodeId) {
// throw new HttpError(
// HttpStatusCode.NOT_FOUND,
// "ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id,
// );
// }
totalPosition = await this.posMasterRepository.count({
where: { orgRootId: requestBody.id },
});
totalPositionCurrentUse = await this.posMasterRepository.count({
where: {
orgRootId: requestBody.id,
current_holderId: Not(IsNull()) && Not(""),
current_holderId: Not(IsNull()) || Not(""),
},
});
totalPositionCurrentVacant = await this.posMasterRepository.count({
where: {
orgRootId: requestBody.id,
current_holderId: IsNull() && "",
current_holderId: IsNull() || "",
},
});
totalPositionNextUse = await this.posMasterRepository.count({
where: {
orgRootId: requestBody.id,
next_holderId: Not(IsNull()) && Not(""),
next_holderId: Not(IsNull()) || Not(""),
},
});
totalPositionNextVacant = await this.posMasterRepository.count({
where: {
orgRootId: requestBody.id,
next_holderId: IsNull() && "",
next_holderId: IsNull() || "",
},
});
break;
}
case 1: {
const NodeId = await this.posMasterRepository.findOne({
where: { orgChild1Id: requestBody.id },
});
if (!NodeId) {
throw new HttpError(
HttpStatusCode.NOT_FOUND,
"ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id,
);
}
// const NodeId = await this.posMasterRepository.findOne({
// where: { orgChild1Id: requestBody.id },
// });
// if (!NodeId) {
// throw new HttpError(
// HttpStatusCode.NOT_FOUND,
// "ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id,
// );
// }
totalPosition = await this.posMasterRepository.count({
where: { orgChild1Id: requestBody.id },
});
totalPositionCurrentUse = await this.posMasterRepository.count({
where: {
orgChild1Id: requestBody.id,
current_holderId: Not(IsNull()) && Not(""),
current_holderId: Not(IsNull()) || Not(""),
},
});
totalPositionCurrentVacant = await this.posMasterRepository.count({
where: {
orgChild1Id: requestBody.id,
current_holderId: IsNull() && "",
current_holderId: IsNull() || "",
},
});
totalPositionNextUse = await this.posMasterRepository.count({
where: {
orgChild1Id: requestBody.id,
next_holderId: Not(IsNull()) && Not(""),
next_holderId: Not(IsNull()) || Not(""),
},
});
totalPositionNextVacant = await this.posMasterRepository.count({
where: {
orgChild1Id: requestBody.id,
next_holderId: IsNull() && "",
next_holderId: IsNull() || "",
},
});
break;
}
case 2: {
const NodeId = await this.posMasterRepository.findOne({
where: { orgChild2Id: requestBody.id },
});
if (!NodeId) {
throw new HttpError(
HttpStatusCode.NOT_FOUND,
"ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id,
);
}
// const NodeId = await this.posMasterRepository.findOne({
// where: { orgChild2Id: requestBody.id },
// });
// if (!NodeId) {
// throw new HttpError(
// HttpStatusCode.NOT_FOUND,
// "ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id,
// );
// }
totalPosition = await this.posMasterRepository.count({
where: { orgChild2Id: requestBody.id },
});
totalPositionCurrentUse = await this.posMasterRepository.count({
where: {
orgChild2Id: requestBody.id,
current_holderId: Not(IsNull()) && Not(""),
current_holderId: Not(IsNull()) || Not(""),
},
});
totalPositionCurrentVacant = await this.posMasterRepository.count({
where: {
orgChild2Id: requestBody.id,
current_holderId: IsNull() && "",
current_holderId: IsNull() || "",
},
});
totalPositionNextUse = await this.posMasterRepository.count({
where: {
orgChild2Id: requestBody.id,
next_holderId: Not(IsNull()) && Not(""),
next_holderId: Not(IsNull()) || Not(""),
},
});
totalPositionNextVacant = await this.posMasterRepository.count({
where: {
orgChild2Id: requestBody.id,
next_holderId: IsNull() && "",
next_holderId: IsNull() || "",
},
});
break;
}
case 3: {
const NodeId = await this.posMasterRepository.findOne({
where: { orgChild3Id: requestBody.id },
});
if (!NodeId) {
throw new HttpError(
HttpStatusCode.NOT_FOUND,
"ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id,
);
}
// const NodeId = await this.posMasterRepository.findOne({
// where: { orgChild3Id: requestBody.id },
// });
// if (!NodeId) {
// throw new HttpError(
// HttpStatusCode.NOT_FOUND,
// "ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id,
// );
// }
totalPosition = await this.posMasterRepository.count({
where: { orgChild3Id: requestBody.id },
});
totalPositionCurrentUse = await this.posMasterRepository.count({
where: {
orgChild3Id: requestBody.id,
current_holderId: Not(IsNull()) && Not(""),
current_holderId: Not(IsNull()) || Not(""),
},
});
totalPositionCurrentVacant = await this.posMasterRepository.count({
where: {
orgChild3Id: requestBody.id,
current_holderId: IsNull() && "",
current_holderId: IsNull() || "",
},
});
totalPositionNextUse = await this.posMasterRepository.count({
where: {
orgChild3Id: requestBody.id,
next_holderId: Not(IsNull()) && Not(""),
next_holderId: Not(IsNull()) || Not(""),
},
});
totalPositionNextVacant = await this.posMasterRepository.count({
where: {
orgChild3Id: requestBody.id,
next_holderId: IsNull() && "",
next_holderId: IsNull() || "",
},
});
break;
}
case 4: {
const NodeId = await this.posMasterRepository.findOne({
where: { orgChild4Id: requestBody.id },
});
if (!NodeId) {
throw new HttpError(
HttpStatusCode.NOT_FOUND,
"ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id,
);
}
// const NodeId = await this.posMasterRepository.findOne({
// where: { orgChild4Id: requestBody.id },
// });
// if (!NodeId) {
// throw new HttpError(
// HttpStatusCode.NOT_FOUND,
// "ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id,
// );
// }
totalPosition = await this.posMasterRepository.count({
where: { orgChild4Id: requestBody.id },
});
totalPositionCurrentUse = await this.posMasterRepository.count({
where: {
orgChild4Id: requestBody.id,
current_holderId: Not(IsNull()) && Not(""),
current_holderId: Not(IsNull()) || Not(""),
},
});
totalPositionCurrentVacant = await this.posMasterRepository.count({
where: {
orgChild4Id: requestBody.id,
current_holderId: IsNull() && "",
current_holderId: IsNull() || "",
},
});
totalPositionNextUse = await this.posMasterRepository.count({
where: {
orgChild4Id: requestBody.id,
next_holderId: Not(IsNull()) && Not(""),
next_holderId: Not(IsNull()) || Not(""),
},
});
totalPositionNextVacant = await this.posMasterRepository.count({
where: {
orgChild4Id: requestBody.id,
next_holderId: IsNull() && "",
next_holderId: IsNull() || "",
},
});
break;
@ -1393,15 +1393,15 @@ export class PositionController extends Controller {
} else {
switch (requestBody.type) {
case 0: {
const NodeId = await this.posMasterRepository.findOne({
where: { orgRootId: requestBody.id },
});
if (!NodeId) {
throw new HttpError(
HttpStatusCode.NOT_FOUND,
"ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id,
);
}
// const NodeId = await this.posMasterRepository.findOne({
// where: { orgRootId: requestBody.id },
// });
// if (!NodeId) {
// throw new HttpError(
// HttpStatusCode.NOT_FOUND,
// "ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id,
// );
// }
totalPosition = await this.posMasterRepository.count({
where: {
orgRootId: requestBody.id,
@ -1454,15 +1454,15 @@ export class PositionController extends Controller {
break;
}
case 1: {
const NodeId = await this.posMasterRepository.findOne({
where: { orgChild1Id: requestBody.id },
});
if (!NodeId) {
throw new HttpError(
HttpStatusCode.NOT_FOUND,
"ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id,
);
}
// const NodeId = await this.posMasterRepository.findOne({
// where: { orgChild1Id: requestBody.id },
// });
// if (!NodeId) {
// throw new HttpError(
// HttpStatusCode.NOT_FOUND,
// "ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id,
// );
// }
totalPosition = await this.posMasterRepository.count({
where: {
orgRootId: Not(IsNull()) || Not(""),
@ -1479,7 +1479,7 @@ export class PositionController extends Controller {
orgChild2Id: IsNull() || "",
orgChild3Id: IsNull() || "",
orgChild4Id: IsNull() || "",
current_holderId: Not(IsNull()) && Not(""),
current_holderId: Not(IsNull()) || Not(""),
},
});
totalPositionCurrentVacant = await this.posMasterRepository.count({
@ -1489,7 +1489,7 @@ export class PositionController extends Controller {
orgChild2Id: IsNull() || "",
orgChild3Id: IsNull() || "",
orgChild4Id: IsNull() || "",
current_holderId: IsNull() && "",
current_holderId: IsNull() || "",
},
});
totalPositionNextUse = await this.posMasterRepository.count({
@ -1499,7 +1499,7 @@ export class PositionController extends Controller {
orgChild2Id: IsNull() || "",
orgChild3Id: IsNull() || "",
orgChild4Id: IsNull() || "",
next_holderId: Not(IsNull()) && Not(""),
next_holderId: Not(IsNull()) || Not(""),
},
});
totalPositionNextVacant = await this.posMasterRepository.count({
@ -1509,21 +1509,21 @@ export class PositionController extends Controller {
orgChild2Id: IsNull() || "",
orgChild3Id: IsNull() || "",
orgChild4Id: IsNull() || "",
next_holderId: IsNull() && "",
next_holderId: IsNull() || "",
},
});
break;
}
case 2: {
const NodeId = await this.posMasterRepository.findOne({
where: { orgChild2Id: requestBody.id },
});
if (!NodeId) {
throw new HttpError(
HttpStatusCode.NOT_FOUND,
"ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id,
);
}
// const NodeId = await this.posMasterRepository.findOne({
// where: { orgChild2Id: requestBody.id },
// });
// if (!NodeId) {
// throw new HttpError(
// HttpStatusCode.NOT_FOUND,
// "ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id,
// );
// }
totalPosition = await this.posMasterRepository.count({
where: {
orgRootId: Not(IsNull()) || Not(""),
@ -1540,7 +1540,7 @@ export class PositionController extends Controller {
orgChild2Id: requestBody.id,
orgChild3Id: IsNull() || "",
orgChild4Id: IsNull() || "",
current_holderId: Not(IsNull()) && Not(""),
current_holderId: Not(IsNull()) || Not(""),
},
});
totalPositionCurrentVacant = await this.posMasterRepository.count({
@ -1550,7 +1550,7 @@ export class PositionController extends Controller {
orgChild2Id: requestBody.id,
orgChild3Id: IsNull() || "",
orgChild4Id: IsNull() || "",
current_holderId: IsNull() && "",
current_holderId: IsNull() || "",
},
});
totalPositionNextUse = await this.posMasterRepository.count({
@ -1560,7 +1560,7 @@ export class PositionController extends Controller {
orgChild2Id: requestBody.id,
orgChild3Id: IsNull() || "",
orgChild4Id: IsNull() || "",
next_holderId: Not(IsNull()) && Not(""),
next_holderId: Not(IsNull()) || Not(""),
},
});
totalPositionNextVacant = await this.posMasterRepository.count({
@ -1570,21 +1570,21 @@ export class PositionController extends Controller {
orgChild2Id: requestBody.id,
orgChild3Id: IsNull() || "",
orgChild4Id: IsNull() || "",
next_holderId: IsNull() && "",
next_holderId: IsNull() || "",
},
});
break;
}
case 3: {
const NodeId = await this.posMasterRepository.findOne({
where: { orgChild3Id: requestBody.id },
});
if (!NodeId) {
throw new HttpError(
HttpStatusCode.NOT_FOUND,
"ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id,
);
}
// const NodeId = await this.posMasterRepository.findOne({
// where: { orgChild3Id: requestBody.id },
// });
// if (!NodeId) {
// throw new HttpError(
// HttpStatusCode.NOT_FOUND,
// "ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id,
// );
// }
totalPosition = await this.posMasterRepository.count({
where: {
orgRootId: Not(IsNull()) || Not(""),
@ -1601,7 +1601,7 @@ export class PositionController extends Controller {
orgChild2Id: Not(IsNull()) || Not(""),
orgChild3Id: requestBody.id,
orgChild4Id: IsNull() || "",
current_holderId: Not(IsNull()) && Not(""),
current_holderId: Not(IsNull()) || Not(""),
},
});
totalPositionCurrentVacant = await this.posMasterRepository.count({
@ -1611,7 +1611,7 @@ export class PositionController extends Controller {
orgChild2Id: Not(IsNull()) || Not(""),
orgChild3Id: requestBody.id,
orgChild4Id: IsNull() || "",
current_holderId: IsNull() && "",
current_holderId: IsNull() || "",
},
});
totalPositionNextUse = await this.posMasterRepository.count({
@ -1621,7 +1621,7 @@ export class PositionController extends Controller {
orgChild2Id: Not(IsNull()) || Not(""),
orgChild3Id: requestBody.id,
orgChild4Id: IsNull() || "",
next_holderId: Not(IsNull()) && Not(""),
next_holderId: Not(IsNull()) || Not(""),
},
});
totalPositionNextVacant = await this.posMasterRepository.count({
@ -1631,21 +1631,21 @@ export class PositionController extends Controller {
orgChild2Id: Not(IsNull()) || Not(""),
orgChild3Id: requestBody.id,
orgChild4Id: IsNull() || "",
next_holderId: IsNull() && "",
next_holderId: IsNull() || "",
},
});
break;
}
case 4: {
const NodeId = await this.posMasterRepository.findOne({
where: { orgChild4Id: requestBody.id },
});
if (!NodeId) {
throw new HttpError(
HttpStatusCode.NOT_FOUND,
"ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id,
);
}
// const NodeId = await this.posMasterRepository.findOne({
// where: { orgChild4Id: requestBody.id },
// });
// if (!NodeId) {
// throw new HttpError(
// HttpStatusCode.NOT_FOUND,
// "ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id,
// );
// }
totalPosition = await this.posMasterRepository.count({
where: {
orgRootId: Not(IsNull()) || Not(""),
@ -1662,7 +1662,7 @@ export class PositionController extends Controller {
orgChild2Id: Not(IsNull()) || Not(""),
orgChild3Id: Not(IsNull()) || Not(""),
orgChild4Id: requestBody.id,
current_holderId: Not(IsNull()) && Not(""),
current_holderId: Not(IsNull()) || Not(""),
},
});
totalPositionCurrentVacant = await this.posMasterRepository.count({
@ -1672,7 +1672,7 @@ export class PositionController extends Controller {
orgChild2Id: Not(IsNull()) || Not(""),
orgChild3Id: Not(IsNull()) || Not(""),
orgChild4Id: requestBody.id,
current_holderId: IsNull() && "",
current_holderId: IsNull() || "",
},
});
totalPositionNextUse = await this.posMasterRepository.count({
@ -1682,7 +1682,7 @@ export class PositionController extends Controller {
orgChild2Id: Not(IsNull()) || Not(""),
orgChild3Id: Not(IsNull()) || Not(""),
orgChild4Id: requestBody.id,
next_holderId: Not(IsNull()) && Not(""),
next_holderId: Not(IsNull()) || Not(""),
},
});
totalPositionNextVacant = await this.posMasterRepository.count({
@ -1692,7 +1692,7 @@ export class PositionController extends Controller {
orgChild2Id: Not(IsNull()) || Not(""),
orgChild3Id: Not(IsNull()) || Not(""),
orgChild4Id: requestBody.id,
next_holderId: IsNull() && "",
next_holderId: IsNull() || "",
},
});
break;