diff --git a/src/controllers/EvaluationController.ts b/src/controllers/EvaluationController.ts index 16ca3a3..90a1f61 100644 --- a/src/controllers/EvaluationController.ts +++ b/src/controllers/EvaluationController.ts @@ -96,8 +96,8 @@ export class EvaluationController { .andWhere( _data.root != undefined && _data.root != null ? _data.root[0] != null - ? `evaluation.rootId IN (:...root)` - : `evaluation.rootId is null` + ? `evaluation.rootDnaId IN (:...root)` + : `evaluation.rootDnaId is null` : "1=1", { root: _data.root, @@ -106,8 +106,8 @@ export class EvaluationController { .andWhere( _data.child1 != undefined && _data.child1 != null ? _data.child1[0] != null - ? `evaluation.child1Id IN (:...child1)` - : `evaluation.child1Id is null` + ? `evaluation.child1DnaId IN (:...child1)` + : `evaluation.child1DnaId is null` : "1=1", { child1: _data.child1, @@ -116,8 +116,8 @@ export class EvaluationController { .andWhere( _data.child2 != undefined && _data.child2 != null ? _data.child2[0] != null - ? `evaluation.child2Id IN (:...child2)` - : `evaluation.child2Id is null` + ? `evaluation.child2DnaId IN (:...child2)` + : `evaluation.child2DnaId is null` : "1=1", { child2: _data.child2, @@ -126,8 +126,8 @@ export class EvaluationController { .andWhere( _data.child3 != undefined && _data.child3 != null ? _data.child3[0] != null - ? `evaluation.child3Id IN (:...child3)` - : `evaluation.child3Id is null` + ? `evaluation.child3DnaId IN (:...child3)` + : `evaluation.child3DnaId is null` : "1=1", { child3: _data.child3, @@ -136,8 +136,8 @@ export class EvaluationController { .andWhere( _data.child4 != undefined && _data.child4 != null ? _data.child4[0] != null - ? `evaluation.child4Id IN (:...child4)` - : `evaluation.child4Id is null` + ? `evaluation.child4DnaId IN (:...child4)` + : `evaluation.child4DnaId is null` : "1=1", { child4: _data.child4, @@ -444,7 +444,16 @@ export class EvaluationController { } const before = null; - + await new CallAPI() + .GetData(request, `/org/profile/keycloak/commander/${request.user.sub}`) + .then(async (x) => { + evaluation.rootDnaId = x.rootDnaId; + evaluation.child1DnaId = x.child1DnaId; + evaluation.child2DnaId = x.child2DnaId; + evaluation.child3DnaId = x.child3DnaId; + evaluation.child4DnaId = x.child4DnaId; + }) + .catch(); evaluation.step = "PREPARE_DOC_V1"; evaluation.type = requestBody.type == "EXPERT" ? "EXPERT" : "SPECIAL_EXPERT"; evaluation.fullName = requestBody.fullName; @@ -634,11 +643,11 @@ export class EvaluationController { .GetData(request, `/org/profile/keycloak/commander/${request.user.sub}`) .then(async (x) => { org = x.org; - evaluation.rootId = x.rootId; - evaluation.child1Id = x.child1Id; - evaluation.child2Id = x.child2Id; - evaluation.child3Id = x.child3Id; - evaluation.child4Id = x.child4Id; + evaluation.rootDnaId = x.rootDnaId; + evaluation.child1DnaId = x.child1DnaId; + evaluation.child2DnaId = x.child2DnaId; + evaluation.child3DnaId = x.child3DnaId; + evaluation.child4DnaId = x.child4DnaId; }) .catch(); //Evaluation diff --git a/src/controllers/ReportController.ts b/src/controllers/ReportController.ts index ed38751..ae46f30 100644 --- a/src/controllers/ReportController.ts +++ b/src/controllers/ReportController.ts @@ -60,7 +60,7 @@ export class ReoportController { @Get() async sumaryEvaluationReport( @Query("year") year?: string, - @Query("rootid") rootId?: string, + @Query("rootId") rootId?: string, @Query("nameOrg") nameOrg?: string, ) { try { @@ -76,7 +76,7 @@ export class ReoportController { .andWhere(yearInBE && yearInBE != null ? "YEAR(createdAt) = :year" : "1=1", { year: yearInBE, }) - .andWhere("evaluation.orgRootId = :rootId", { rootId: rootId }) + .andWhere("evaluation.rootDnaId = :rootId", { rootId: rootId }) .andWhere("evaluation.step = :step", { step: "DONE" }) .getMany(); diff --git a/src/entities/Evaluation.ts b/src/entities/Evaluation.ts index 5c5f12d..0d7c953 100644 --- a/src/entities/Evaluation.ts +++ b/src/entities/Evaluation.ts @@ -79,6 +79,46 @@ export class Evaluation extends EntityBase { }) child4Id: string; + @Column({ + nullable: true, + comment: "Dna root", + length: 255, + default: null, + }) + rootDnaId: string; + + @Column({ + nullable: true, + comment: "Dna child1", + length: 255, + default: null, + }) + child1DnaId: string; + + @Column({ + nullable: true, + comment: "Dna child2", + length: 255, + default: null, + }) + child2DnaId: string; + + @Column({ + nullable: true, + comment: "Dna child3", + length: 255, + default: null, + }) + child3DnaId: string; + + @Column({ + nullable: true, + comment: "Dna child4", + length: 255, + default: null, + }) + child4DnaId: string; + @Column({ nullable: true, comment: "เงินเดือนปัจจุบัน" }) salary: string; @@ -192,7 +232,7 @@ export class Evaluation extends EntityBase { @Column({ nullable: true, comment: "ตำแหน่งที่ได้รับมอบหมาย" }) assignedPosition: string; - @Column({ nullable: true, comment: "ผลการประเมิน", default: "PENDING" })//PENDING,PASS,NOTPASS + @Column({ nullable: true, comment: "ผลการประเมิน", default: "PENDING" }) //PENDING,PASS,NOTPASS evaluationResult: string; @OneToMany(() => EvaluationLogs, (evaluationLogs) => evaluationLogs.evaluation) @@ -486,6 +526,34 @@ export class CreateEvaluationExpertise { @Column() oc?: string | null; + + @Column() + citizenId?: string | null; + + @Column() + prefix?: string | null; + + @Column() + fullName?: string | null; + + @Column() + position?: string | null; + + @Column() + salary?: string | null; + + @Column() + positionLevel?: string | null; + + @Column() + posNo?: string | null; + + @Column() + birthDate?: string | null; + + @Column() + govAge?: string | null; + } export type UpdateEvaluation = Partial;