ประวัติ reject
This commit is contained in:
parent
6f1b3f9216
commit
e2f3234e2d
4 changed files with 136 additions and 2 deletions
|
|
@ -1048,7 +1048,7 @@ export class KpiUserEvaluationController extends Controller {
|
||||||
@Put("reject-agreement/{id}")
|
@Put("reject-agreement/{id}")
|
||||||
async updateKpiUserStatusRejectAgreementEvaluation(
|
async updateKpiUserStatusRejectAgreementEvaluation(
|
||||||
@Path() id: string,
|
@Path() id: string,
|
||||||
@Body() requestBody: { reason: string },
|
@Body() requestBody: { reason: string; actor: string },
|
||||||
@Request() request: RequestWithUser,
|
@Request() request: RequestWithUser,
|
||||||
) {
|
) {
|
||||||
const kpiUserEvaluation = await this.kpiUserEvalutionRepository.findOne({
|
const kpiUserEvaluation = await this.kpiUserEvalutionRepository.findOne({
|
||||||
|
|
@ -1081,7 +1081,11 @@ export class KpiUserEvaluationController extends Controller {
|
||||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||||
kpiUserEvaluation.lastUpdatedAt = new Date();
|
kpiUserEvaluation.lastUpdatedAt = new Date();
|
||||||
let kpiReject = {
|
let kpiReject = {
|
||||||
|
kpiUserEvaluationId: kpiUserEvaluation.id,
|
||||||
reason: requestBody.reason,
|
reason: requestBody.reason,
|
||||||
|
actor: requestBody.actor,
|
||||||
|
fullname: `${kpiUserEvaluation.prefixEvaluator}${kpiUserEvaluation.firstNameEvaluator} ${kpiUserEvaluation.lastNameEvaluator}`,
|
||||||
|
profileId: kpiUserEvaluation.evaluatorId,
|
||||||
createdUserId: request.user.sub,
|
createdUserId: request.user.sub,
|
||||||
createdFullName: request.user.name,
|
createdFullName: request.user.name,
|
||||||
lastUpdateUserId: request.user.sub,
|
lastUpdateUserId: request.user.sub,
|
||||||
|
|
@ -1105,7 +1109,7 @@ export class KpiUserEvaluationController extends Controller {
|
||||||
@Put("reject-result/{id}")
|
@Put("reject-result/{id}")
|
||||||
async updateKpiUserStatusRejectResultEvaluation(
|
async updateKpiUserStatusRejectResultEvaluation(
|
||||||
@Path() id: string,
|
@Path() id: string,
|
||||||
@Body() requestBody: { reason: string },
|
@Body() requestBody: { reason: string; actor: string },
|
||||||
@Request() request: RequestWithUser,
|
@Request() request: RequestWithUser,
|
||||||
) {
|
) {
|
||||||
const kpiUserEvaluation = await this.kpiUserEvalutionRepository.findOne({
|
const kpiUserEvaluation = await this.kpiUserEvalutionRepository.findOne({
|
||||||
|
|
@ -1131,12 +1135,19 @@ export class KpiUserEvaluationController extends Controller {
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
const before = structuredClone(kpiUserEvaluation);
|
const before = structuredClone(kpiUserEvaluation);
|
||||||
kpiUserEvaluation.evaluationStatus = "EVALUATING_EVALUATOR";
|
kpiUserEvaluation.evaluationStatus = "EVALUATING_EVALUATOR";
|
||||||
|
let _null: any = null;
|
||||||
|
kpiUserEvaluation.isReasonCommander = _null;
|
||||||
|
kpiUserEvaluation.reasonCommander = _null;
|
||||||
kpiUserEvaluation.reasonReject = requestBody.reason;
|
kpiUserEvaluation.reasonReject = requestBody.reason;
|
||||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||||
kpiUserEvaluation.lastUpdatedAt = new Date();
|
kpiUserEvaluation.lastUpdatedAt = new Date();
|
||||||
let kpiReject = {
|
let kpiReject = {
|
||||||
|
kpiUserEvaluationId: kpiUserEvaluation.id,
|
||||||
reason: requestBody.reason,
|
reason: requestBody.reason,
|
||||||
|
actor: requestBody.actor,
|
||||||
|
fullname: `${kpiUserEvaluation.prefixEvaluator}${kpiUserEvaluation.firstNameEvaluator} ${kpiUserEvaluation.lastNameEvaluator}`,
|
||||||
|
profileId: kpiUserEvaluation.evaluatorId,
|
||||||
createdUserId: request.user.sub,
|
createdUserId: request.user.sub,
|
||||||
createdFullName: request.user.name,
|
createdFullName: request.user.name,
|
||||||
lastUpdateUserId: request.user.sub,
|
lastUpdateUserId: request.user.sub,
|
||||||
|
|
@ -1150,6 +1161,61 @@ export class KpiUserEvaluationController extends Controller {
|
||||||
return new HttpSuccess(kpiUserEvaluation.id);
|
return new HttpSuccess(kpiUserEvaluation.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API แก้ไขสถานะประเมิน (USER)
|
||||||
|
*
|
||||||
|
* @summary แก้ไขคนประเมิน (USER)
|
||||||
|
*
|
||||||
|
* @param {string} id Guid, *Id คนประเมิน (USER)
|
||||||
|
*/
|
||||||
|
@Get("reject-agreement/{id}")
|
||||||
|
async listKpiUserStatusRejectAgreementEvaluation(
|
||||||
|
@Path() id: string,
|
||||||
|
@Request() request: RequestWithUser,
|
||||||
|
) {
|
||||||
|
const kpiUserEvaluation = await this.kpiUserEvalutionRepository.findOne({
|
||||||
|
where: { id: id },
|
||||||
|
relations: ["kpiUserRejectAgreements"],
|
||||||
|
order: { kpiUserRejectAgreements: { createdAt: "ASC" } },
|
||||||
|
});
|
||||||
|
if (!kpiUserEvaluation) {
|
||||||
|
throw new HttpError(
|
||||||
|
HttpStatusCode.NOT_FOUND,
|
||||||
|
"ไม่พบข้อมูลรายการประเมินผลการปฏิบัติราชการระดับบุคคลนี้",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
kpiUserEvaluation.kpiUserRejectAgreements;
|
||||||
|
return new HttpSuccess(kpiUserEvaluation.kpiUserRejectAgreements);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API แก้ไขสถานะประเมิน (USER)
|
||||||
|
*
|
||||||
|
* @summary แก้ไขคนประเมิน (USER)
|
||||||
|
*
|
||||||
|
* @param {string} id Guid, *Id คนประเมิน (USER)
|
||||||
|
*/
|
||||||
|
@Get("reject-result/{id}")
|
||||||
|
async listKpiUserStatusRejectResultEvaluation(
|
||||||
|
@Path() id: string,
|
||||||
|
@Body() requestBody: { reason: string },
|
||||||
|
@Request() request: RequestWithUser,
|
||||||
|
) {
|
||||||
|
const kpiUserEvaluation = await this.kpiUserEvalutionRepository.findOne({
|
||||||
|
where: { id: id },
|
||||||
|
relations: ["kpiUserRejectResults"],
|
||||||
|
order: { kpiUserRejectResults: { createdAt: "ASC" } },
|
||||||
|
});
|
||||||
|
if (!kpiUserEvaluation) {
|
||||||
|
throw new HttpError(
|
||||||
|
HttpStatusCode.NOT_FOUND,
|
||||||
|
"ไม่พบข้อมูลรายการประเมินผลการปฏิบัติราชการระดับบุคคลนี้",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
kpiUserEvaluation.kpiUserRejectResults;
|
||||||
|
return new HttpSuccess(kpiUserEvaluation.kpiUserRejectResults);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API รายละเอียดรายการประเมินผลการปฏิบัติราชการระดับบุคคล (USER)
|
* API รายละเอียดรายการประเมินผลการปฏิบัติราชการระดับบุคคล (USER)
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,28 @@ import { KpiUserEvaluation } from "./kpiUserEvaluation";
|
||||||
|
|
||||||
@Entity("kpiUserRejectAgreement")
|
@Entity("kpiUserRejectAgreement")
|
||||||
export class KpiUserRejectAgreement extends EntityBase {
|
export class KpiUserRejectAgreement extends EntityBase {
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อคนรับการประเมิน",
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
fullname: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 40,
|
||||||
|
comment: "ไอดีโปรไฟล์",
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
profileId: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
comment: "ผู้ดำเนิน",
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
actor: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
comment: "หมายเหตุ",
|
comment: "หมายเหตุ",
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,28 @@ import { KpiUserEvaluation } from "./kpiUserEvaluation";
|
||||||
|
|
||||||
@Entity("kpiUserRejectResult")
|
@Entity("kpiUserRejectResult")
|
||||||
export class KpiUserRejectResult extends EntityBase {
|
export class KpiUserRejectResult extends EntityBase {
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อคนรับการประเมิน",
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
fullname: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 40,
|
||||||
|
comment: "ไอดีโปรไฟล์",
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
profileId: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
comment: "ผู้ดำเนิน",
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
actor: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
comment: "หมายเหตุ",
|
comment: "หมายเหตุ",
|
||||||
|
|
|
||||||
24
src/migration/1738123092759-Updateevaaddreject1.ts
Normal file
24
src/migration/1738123092759-Updateevaaddreject1.ts
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
|
export class Updateevaaddreject11738123092759 implements MigrationInterface {
|
||||||
|
name = 'Updateevaaddreject11738123092759'
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`kpiUserRejectAgreement\` ADD \`fullname\` varchar(255) NULL COMMENT 'ชื่อคนรับการประเมิน'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`kpiUserRejectAgreement\` ADD \`profileId\` varchar(40) NULL COMMENT 'ไอดีโปรไฟล์'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`kpiUserRejectAgreement\` ADD \`actor\` varchar(255) NULL COMMENT 'ผู้ดำเนิน'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`kpiUserRejectResult\` ADD \`fullname\` varchar(255) NULL COMMENT 'ชื่อคนรับการประเมิน'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`kpiUserRejectResult\` ADD \`profileId\` varchar(40) NULL COMMENT 'ไอดีโปรไฟล์'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`kpiUserRejectResult\` ADD \`actor\` varchar(255) NULL COMMENT 'ผู้ดำเนิน'`);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`kpiUserRejectResult\` DROP COLUMN \`actor\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`kpiUserRejectResult\` DROP COLUMN \`profileId\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`kpiUserRejectResult\` DROP COLUMN \`fullname\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`kpiUserRejectAgreement\` DROP COLUMN \`actor\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`kpiUserRejectAgreement\` DROP COLUMN \`profileId\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`kpiUserRejectAgreement\` DROP COLUMN \`fullname\``);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue