org_068
This commit is contained in:
parent
094c7775ea
commit
145e64b655
2 changed files with 37 additions and 1 deletions
|
|
@ -1781,4 +1781,40 @@ export class PositionController extends Controller {
|
|||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* API สืบทอดตำแหน่ง
|
||||
*
|
||||
* @summary ORG_068 - สืบทอดตำแหน่ง (ADMIN) #74
|
||||
*
|
||||
*/
|
||||
@Post("dna")
|
||||
async dna(@Body() requestBody: { draftPositionId: string; publishPositionId: string;}) {
|
||||
const dataDraft = await this.posMasterRepository.findOne({
|
||||
where: { id: requestBody.draftPositionId },
|
||||
});
|
||||
if (!dataDraft) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดีนี้(draftPositionId) : " + requestBody.draftPositionId);
|
||||
}
|
||||
|
||||
const dataPublish = await this.posMasterRepository.findOne({
|
||||
where: { id: requestBody.publishPositionId },
|
||||
});
|
||||
if (!dataPublish) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดีนี้(publishPositionId) : " + requestBody.publishPositionId);
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
dataDraft.ancestorDNA = dataPublish.ancestorDNA;
|
||||
await this.posMasterRepository.save(dataDraft);
|
||||
|
||||
dataPublish.ancestorDNA = "";
|
||||
await this.posMasterRepository.save(dataPublish);
|
||||
|
||||
return new HttpSuccess();
|
||||
} catch (error) {
|
||||
return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ import { OrgChild3 } from "../entities/OrgChild3";
|
|||
import { OrgChild4 } from "../entities/OrgChild4";
|
||||
@Route("api/v1/org/report")
|
||||
@Tags("Report")
|
||||
// @Security("bearerAuth")
|
||||
@Security("bearerAuth")
|
||||
@Response(
|
||||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue