สร้างแบบประเมินส่งค่า profile id

This commit is contained in:
Kittapath 2024-06-07 10:24:56 +07:00
parent 5cb9bd2372
commit 983a4e79f7
2 changed files with 34 additions and 14 deletions

View file

@ -202,19 +202,39 @@ export class KpiUserEvaluationController extends Controller {
}
const kpiUserEvaluation = Object.assign(new KpiUserEvaluation(), requestBody);
await new CallAPI()
.GetData(request, "org/profile/keycloak/position")
.then((x) => {
kpiUserEvaluation.profileId = x.profileId;
kpiUserEvaluation.prefix = x.prefix;
kpiUserEvaluation.firstName = x.firstName;
kpiUserEvaluation.lastName = x.lastName;
kpiUserEvaluation.position = x.position;
kpiUserEvaluation.posLevelName = x.posLevelName;
kpiUserEvaluation.posTypeName = x.posTypeName;
kpiUserEvaluation.posExecutiveName = x.posExecutiveName;
})
.catch((x) => {});
if (requestBody.profileId == undefined || requestBody.profileId == null) {
await new CallAPI()
.GetData(request, "org/profile/profileid/position/" + requestBody.profileId)
.then((x) => {
kpiUserEvaluation.profileId = x.profileId;
kpiUserEvaluation.prefix = x.prefix;
kpiUserEvaluation.firstName = x.firstName;
kpiUserEvaluation.lastName = x.lastName;
kpiUserEvaluation.position = x.position;
kpiUserEvaluation.posLevelName = x.posLevelName;
kpiUserEvaluation.posTypeName = x.posTypeName;
kpiUserEvaluation.posExecutiveName = x.posExecutiveName;
})
.catch((x) => {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลในทะเบียนประวัติ");
});
} else {
await new CallAPI()
.GetData(request, "org/profile/keycloak/position")
.then((x) => {
kpiUserEvaluation.profileId = x.profileId;
kpiUserEvaluation.prefix = x.prefix;
kpiUserEvaluation.firstName = x.firstName;
kpiUserEvaluation.lastName = x.lastName;
kpiUserEvaluation.position = x.position;
kpiUserEvaluation.posLevelName = x.posLevelName;
kpiUserEvaluation.posTypeName = x.posTypeName;
kpiUserEvaluation.posExecutiveName = x.posExecutiveName;
})
.catch((x) => {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลในทะเบียนประวัติ");
});
}
kpiUserEvaluation.evaluationStatus = "NEW";
kpiUserEvaluation.evaluationResults = "PENDING";
kpiUserEvaluation.createdUserId = request.user.sub;

View file

@ -202,7 +202,7 @@ export class createKpiUserEvaluation {
@Column()
kpiPeriodId: string;
@Column()
profileId: string;
profileId?: string | null;
@Column()
evaluatorId: string | null;
@Column()