เปิดปิดรอบประเมิน
This commit is contained in:
parent
50f0e205f6
commit
f75bd88f6b
3 changed files with 79 additions and 1 deletions
|
|
@ -88,6 +88,56 @@ export class kpiController extends Controller {
|
|||
return new HttpSuccess(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* API ปิดรอบการประเมินผลการปฏิบัติหน้าที่ราชการ
|
||||
* @param id Guid, *Id ปิดรอบการประเมินผลการปฏิบัติหน้าที่ราชการ
|
||||
*/
|
||||
@Get("close/{id}")
|
||||
@Example({
|
||||
durationKPI: "string", //รอบเดือนที่สร้าง
|
||||
startDate: "datetime", //วันเริ่มต้น
|
||||
endDate: "datetime", //วันสิ้นสุด
|
||||
})
|
||||
async CloseSalaryById(@Path() id: string) {
|
||||
const kpi = await this.kpiRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
if (!kpi) {
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่พบข้อมูลรอบการประเมินผลการปฏิบัติหน้าที่ราชการนี้",
|
||||
);
|
||||
}
|
||||
kpi.isActive = false;
|
||||
await this.kpiRepository.save(kpi);
|
||||
return new HttpSuccess(kpi);
|
||||
}
|
||||
|
||||
/**
|
||||
* API เปิดรอบการประเมินผลการปฏิบัติหน้าที่ราชการ
|
||||
* @param id Guid, *Id เปิดรอบการประเมินผลการปฏิบัติหน้าที่ราชการ
|
||||
*/
|
||||
@Get("open/{id}")
|
||||
@Example({
|
||||
durationKPI: "string", //รอบเดือนที่สร้าง
|
||||
startDate: "datetime", //วันเริ่มต้น
|
||||
endDate: "datetime", //วันสิ้นสุด
|
||||
})
|
||||
async OpenSalaryById(@Path() id: string) {
|
||||
const kpi = await this.kpiRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
if (!kpi) {
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่พบข้อมูลรอบการประเมินผลการปฏิบัติหน้าที่ราชการนี้",
|
||||
);
|
||||
}
|
||||
kpi.isActive = true;
|
||||
await this.kpiRepository.save(kpi);
|
||||
return new HttpSuccess(kpi);
|
||||
}
|
||||
|
||||
/**
|
||||
* API รอบการประเมินผลการปฏิบัติหน้าที่ราชการ
|
||||
* @param id Guid, *Id รอบการประเมินผลการปฏิบัติหน้าที่ราชการ
|
||||
|
|
@ -101,7 +151,7 @@ export class kpiController extends Controller {
|
|||
async GetSalaryById(@Path() id: string) {
|
||||
const kpi = await this.kpiRepository.findOne({
|
||||
where: { id: id },
|
||||
select: ["durationKPI", "startDate", "endDate"],
|
||||
select: ["durationKPI", "startDate", "endDate", "isActive"],
|
||||
});
|
||||
if (!kpi) {
|
||||
throw new HttpError(
|
||||
|
|
@ -122,9 +172,13 @@ export class kpiController extends Controller {
|
|||
async listKpiPeriod(
|
||||
@Query("page") page: number = 1,
|
||||
@Query("pageSize") pageSize: number = 10,
|
||||
@Query("year") year?: string,
|
||||
@Query("keyword") keyword?: string,
|
||||
) {
|
||||
const [kpiPeriod, total] = await this.kpiRepository.findAndCount({
|
||||
// where: {
|
||||
// name: Like(`%${keyword}%`),
|
||||
// },
|
||||
...(keyword ? {} : { skip: (page - 1) * pageSize, take: pageSize }),
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue