บันทึกลงทะเบียนประวัติ

This commit is contained in:
Kittapath 2024-04-10 11:53:25 +07:00
parent 166c919bbe
commit b8e1c93cb4
3 changed files with 77 additions and 7 deletions

View file

@ -24,6 +24,7 @@ import {
} from "../entities/DevelopmentScholarship";
import { PosType } from "../entities/PosType";
import { PosLevel } from "../entities/PosLevel";
import CallAPI from "../interfaces/call-api";
@Route("api/v1/development/scholarship")
@Tags("DevelopmentScholarship")
@ -75,7 +76,7 @@ export class DevelopmentScholarshipController extends Controller {
*
* @summary DEV_012 - / #12
*
* @param {string} id Id
* @param {string} id Id
*/
@Put("{id}")
async UpdateDevelopmentScholarship(
@ -117,7 +118,7 @@ export class DevelopmentScholarshipController extends Controller {
*
* @summary DEV_013 - / #13
*
* @param {string} id Id
* @param {string} id Id
*/
@Delete("{id}")
async DeleteDevelopmentScholarship(@Path() id: string) {
@ -224,7 +225,7 @@ export class DevelopmentScholarshipController extends Controller {
*
* @summary DEV_015 - / #15
*
* @param {string} id Id
* @param {string} id Id
*/
@Get("{id}")
async GetDevelopemtScholarshipById(@Path() id: string) {
@ -321,11 +322,15 @@ export class DevelopmentScholarshipController extends Controller {
*
* @summary DEV_0 - #
*
* @param {string} id Id
* @param {string} id Id
* @param {string} status status
*/
@Get("status/{id}/{status}")
async ChangeStatusDevelopemtScholarshipById(@Path() id: string, @Path() status: string) {
async ChangeStatusDevelopemtScholarshipById(
@Path() id: string,
@Path() status: string,
@Request() request: { user: Record<string, any> },
) {
const getDevelopment = await this.developmentScholarshipRepository.findOne({
where: { id: id },
});
@ -335,12 +340,53 @@ export class DevelopmentScholarshipController extends Controller {
const _status = status.trim().toUpperCase();
getDevelopment.status = _status;
if (_status == "GRADUATE") {
//xxxxxxxxxxxxxxxxxxxบันทึกลงทะเบียน
if (getDevelopment.scholarshipType != null) {
switch (getDevelopment.scholarshipType.trim().toUpperCase()) {
case "DOMESTICE":
getDevelopment.scholarshipType = "การศึกษาในประเทศ";
break;
case "NOABROAD":
getDevelopment.scholarshipType =
"ฝึกอบรมในประเทศที่ส่งไปพัฒนากับหน่วยวงานภายนอก (หลักสูตรที่ไม่มีการไปต่างประเทศ)";
break;
case "ABROAD":
getDevelopment.scholarshipType =
"ฝึกอบรมในประเทศที่ส่งไปพัฒนากับหน่วยวงานภายนอก (หลักสูตรที่มีการไปต่างประเทศ)";
break;
case "EXECUTIVE":
getDevelopment.scholarshipType =
"ฝึกอบรมในประเทศที่ส่งไปพัฒนากับหน่วยวงานภายนอก (หลักสูตรประเภทนักบริหาร)";
break;
default:
break;
}
}
let profileEdu = await new CallAPI().PostData(request, "org/profile/educations", {
profileId: getDevelopment.profileId,
institute: getDevelopment.educationalInstitution,
startDate: getDevelopment.startDate,
endDate: getDevelopment.endDate,
finishDate: null,
isEducation: false,
degree: null,
field: getDevelopment.field,
fundName: getDevelopment.scholarshipType,
gpa: null,
country: getDevelopment.studyCountry,
other: null,
duration: getDevelopment.totalPeriod,
durationYear: 0,
note: null,
educationLevel: getDevelopment.degreeLevel,
educationLevelId: null,
isDate: false,
positionPath: null,
positionPathId: null,
});
} else if (_status == "NOTGRADUATE") {
} else {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบสถานะนี้ในระบบ");
}
await this.developmentScholarshipRepository.remove(getDevelopment);
return new HttpSuccess();
}