แก้ api สืบทอดตำแหน่ง
This commit is contained in:
parent
179bd7f2d0
commit
634c82eb5c
1 changed files with 16 additions and 13 deletions
|
|
@ -1801,6 +1801,9 @@ export class PositionController extends Controller {
|
|||
orgRevisionIsDraft: true,
|
||||
},
|
||||
});
|
||||
if (!findDraft) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลโครงสร้างที่เผยแพร่");
|
||||
}
|
||||
|
||||
const dataPublish = await this.posMasterRepository.findOne({
|
||||
where: {
|
||||
|
|
@ -1826,22 +1829,22 @@ export class PositionController extends Controller {
|
|||
);
|
||||
}
|
||||
|
||||
const dataPosMaster = await this.posMasterRepository.find({
|
||||
where: {
|
||||
orgRevisionId: findDraft?.id,
|
||||
ancestorDNA: dataPublish.ancestorDNA,
|
||||
},
|
||||
});
|
||||
if (!dataPosMaster) {
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่พบข้อมูลไอดีนี้ใน posMaster (publishPositionId) : " + requestBody.publishPositionId,
|
||||
);
|
||||
}
|
||||
// const dataPosMaster = await this.posMasterRepository.find({
|
||||
// where: {
|
||||
// orgRevisionId: findDraft?.id,
|
||||
// ancestorDNA: dataPublish.ancestorDNA,
|
||||
// },
|
||||
// });
|
||||
// if (!dataPosMaster) {
|
||||
// throw new HttpError(
|
||||
// HttpStatusCode.NOT_FOUND,
|
||||
// "ไม่พบข้อมูลไอดีนี้ใน posMaster (publishPositionId) : " + requestBody.publishPositionId,
|
||||
// );
|
||||
// }
|
||||
|
||||
try {
|
||||
await this.posMasterRepository.update(
|
||||
{ orgRevisionId: findDraft?.id, ancestorDNA: dataPublish.ancestorDNA },
|
||||
{ orgRevisionId: findDraft.id, ancestorDNA: dataPublish.ancestorDNA },
|
||||
{ ancestorDNA: "" },
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue