api รายละเอียดทุน & แก้ไขรายละเอียดทุน สำหรับเจ้าหน้าที่
This commit is contained in:
parent
588178f042
commit
65899d936a
1 changed files with 65 additions and 0 deletions
|
|
@ -559,6 +559,41 @@ export class DevelopmentScholarshipController extends Controller {
|
||||||
return new HttpSuccess(getDevelopment);
|
return new HttpSuccess(getDevelopment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API รายละเอียดทุนของ admin
|
||||||
|
*
|
||||||
|
* @summary DEV_0 - รายละเอียดทุนของ admin #
|
||||||
|
*
|
||||||
|
* @param {string} id id รายการ
|
||||||
|
*/
|
||||||
|
@Get("admin/detail/{id}")
|
||||||
|
async GetDevelopemtScholarshipUserDetailAdminById(@Request() request: RequestWithUser, @Path() id: string) {
|
||||||
|
let _workflow = await new permission().Workflow(request, id, "SYS_DEV_SCHOLARSHIP");
|
||||||
|
if (_workflow == false) await new permission().PermissionGet(request, "SYS_DEV_SCHOLARSHIP");
|
||||||
|
const getDevelopment = await this.developmentScholarshipRepository.findOne({
|
||||||
|
where: { id: id },
|
||||||
|
select: [
|
||||||
|
"id",
|
||||||
|
"scholarshipYear",
|
||||||
|
"scholarshipType",
|
||||||
|
"fundType",
|
||||||
|
"bookNumber",
|
||||||
|
"bookDate",
|
||||||
|
"governmentDate",
|
||||||
|
"governmentEndDate",
|
||||||
|
"isGraduated",
|
||||||
|
"graduatedDate",
|
||||||
|
"graduatedReason",
|
||||||
|
"org",
|
||||||
|
],
|
||||||
|
});
|
||||||
|
if (!getDevelopment) {
|
||||||
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทุนการศึกษา/ฝึกอบรมนี้");
|
||||||
|
}
|
||||||
|
|
||||||
|
return new HttpSuccess(getDevelopment);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API รายละเอียดทุนของ user
|
* API รายละเอียดทุนของ user
|
||||||
*
|
*
|
||||||
|
|
@ -622,6 +657,36 @@ export class DevelopmentScholarshipController extends Controller {
|
||||||
return new HttpSuccess(getDevelopment.id);
|
return new HttpSuccess(getDevelopment.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API แก้ไขรายการทุนของ admin
|
||||||
|
*
|
||||||
|
* @summary DEV_015 - แก้ไขรายการทุนของ admin #15
|
||||||
|
*
|
||||||
|
* @param {string} id รายการ
|
||||||
|
*/
|
||||||
|
@Put("admin/detail/{id}")
|
||||||
|
async UpdateDevelopemtScholarshipAdminById(
|
||||||
|
@Path() id: string,
|
||||||
|
@Body() requestBody: UpdateDevelopmentScholarshipUser,
|
||||||
|
@Request() request: RequestWithUser,
|
||||||
|
) {
|
||||||
|
await new permission().PermissionUpdate(request, "SYS_DEV_SCHOLARSHIP");
|
||||||
|
const getDevelopment = await this.developmentScholarshipRepository.findOne({
|
||||||
|
where: { id: id },
|
||||||
|
});
|
||||||
|
if (!getDevelopment) {
|
||||||
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทุนการศึกษา/ฝึกอบรมนี้");
|
||||||
|
}
|
||||||
|
const before = structuredClone(getDevelopment);
|
||||||
|
Object.assign(getDevelopment, requestBody);
|
||||||
|
getDevelopment.lastUpdateUserId = request.user.sub;
|
||||||
|
getDevelopment.lastUpdateFullName = request.user.name;
|
||||||
|
getDevelopment.lastUpdatedAt = new Date();
|
||||||
|
await this.developmentScholarshipRepository.save(getDevelopment, { data: request });
|
||||||
|
setLogDataDiff(request, { before, after: getDevelopment });
|
||||||
|
return new HttpSuccess(getDevelopment.id);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API เปลี่ยนสถานะ
|
* API เปลี่ยนสถานะ
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue