update field and api update duty
This commit is contained in:
parent
5abaacdf15
commit
879b6bfd0b
3 changed files with 49 additions and 0 deletions
|
|
@ -193,6 +193,34 @@ export class DirectorController {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* API สำหรับแก้ไขรายละเอียดกรรมการ
|
||||
*
|
||||
* @summary แก้ไขรายละเอียดกรรมการ (ADMIN)
|
||||
*
|
||||
*/
|
||||
@Put("duty/{id}")
|
||||
async updateDuty(@Path() id: string, @Body() body:{duty: string} , @Request() request: RequestWithUser) {
|
||||
try {
|
||||
await new permission().PermissionUpdate(request, "SYS_EVA_INFO");
|
||||
let director = await this.directorRepository.findOneBy({ id });
|
||||
if (!director) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลกรรมการ");
|
||||
}
|
||||
const before = structuredClone(director);
|
||||
director.duty = body?.duty;
|
||||
director.lastUpdateUserId = request.user.sub;
|
||||
director.lastUpdateFullName = request.user.name;
|
||||
director.lastUpdatedAt = new Date();
|
||||
await this.directorRepository.save(director, { data: request });
|
||||
setLogDataDiff(request, { before, after: director });
|
||||
return new HttpSuccess();
|
||||
} catch (error: any) {
|
||||
if (error instanceof HttpError) {
|
||||
throw error;
|
||||
} else throw new HttpError(HttpStatusCode.INTERNAL_SERVER_ERROR, error);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* API สำหรับแก้ไขรายละเอียดกรรมการ
|
||||
*
|
||||
|
|
|
|||
|
|
@ -25,6 +25,9 @@ export class Director extends EntityBase {
|
|||
@Column({ nullable: true, comment: "ตำแหน่ง" })
|
||||
position: string;
|
||||
|
||||
@Column({ nullable: true, comment: "หน้าที่" })
|
||||
duty: string;
|
||||
|
||||
@ManyToMany(() => Evaluation, (evaluation) => evaluation.directors)
|
||||
evaluations: Evaluation[];
|
||||
}
|
||||
|
|
@ -47,5 +50,8 @@ export class CreateDirector {
|
|||
|
||||
@Column()
|
||||
position: string;
|
||||
|
||||
// @Column()
|
||||
// duty?: string;
|
||||
}
|
||||
export type UpdateDirector = Partial<Director>;
|
||||
|
|
|
|||
|
|
@ -199,6 +199,21 @@ export class Evaluation extends EntityBase {
|
|||
@Column({ nullable: true, comment: "ตำแหน่ง ผู้บังคับบัญชาชั้นต้น (จัดเตรียมเอกสารเล่ม 2)" })
|
||||
commanderPositionDoc2: string;
|
||||
|
||||
|
||||
@Column({ nullable: true, comment: "สังกัดปัจุบัน ผู้บังคับบัญชาชั้นต้น" })
|
||||
commanderOrg: string;
|
||||
@Column({ nullable: true, comment: "สังกัดเดิม ผู้บังคับบัญชาชั้นต้น" })
|
||||
commanderOrgOld: string;
|
||||
@Column({ nullable: true, comment: "ตำแหน่งเดิม ผู้บังคับบัญชาชั้นต้น" })
|
||||
commanderPositionOld: string;
|
||||
|
||||
@Column({ nullable: true, comment: "สังกัดปัจุบัน ผู้บังคับบัญชาเหนือขึ้นไป 1 ระดับ" })
|
||||
commanderAboveOrg: string;
|
||||
@Column({ nullable: true, comment: "สังกัดเดิม ผู้บังคับบัญชาเหนือขึ้นไป 1 ระดับ" })
|
||||
commanderAboveOrgOld: string;
|
||||
@Column({ nullable: true, comment: "ตำแหน่งเดิม ผู้บังคับบัญชาเหนือขึ้นไป 1 ระดับ" })
|
||||
commanderAbovePositionOld: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ชื่อ-นามสกุล ผู้บังคับบัญชาเหนือขึ้นไป 1 ระดับ (จัดเตรียมเอกสารเล่ม 2)",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue