fixing throw HttpError
This commit is contained in:
parent
78be6d81b2
commit
0e54b8b880
8 changed files with 90 additions and 90 deletions
|
|
@ -72,7 +72,7 @@ export class AssignController extends Controller {
|
|||
});
|
||||
|
||||
if (!person) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลบุคคล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลบุคคล");
|
||||
}
|
||||
|
||||
const roundNo = await this.assignRepository.count({
|
||||
|
|
@ -231,7 +231,7 @@ export class AssignController extends Controller {
|
|||
let before = assign;
|
||||
|
||||
if (!assign) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
|
||||
}
|
||||
|
||||
const person = await this.personalRepository.findOne({
|
||||
|
|
@ -241,7 +241,7 @@ export class AssignController extends Controller {
|
|||
});
|
||||
|
||||
if (!person) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลบุคคล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลบุคคล");
|
||||
}
|
||||
|
||||
const data: any = {
|
||||
|
|
@ -511,7 +511,7 @@ export class AssignController extends Controller {
|
|||
});
|
||||
|
||||
if (!assign) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
|
||||
}
|
||||
|
||||
const profileData = await this.personalRepository.findOne({
|
||||
|
|
@ -532,7 +532,7 @@ export class AssignController extends Controller {
|
|||
});
|
||||
|
||||
if (!profileData) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลบุคคล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลบุคคล");
|
||||
}
|
||||
|
||||
const profile = {
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ export class DataOptionController extends Controller {
|
|||
});
|
||||
|
||||
if (!person) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลบุคคล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลบุคคล");
|
||||
}
|
||||
|
||||
let result = await this.mapKnowledgeSkillRepository.findOne({
|
||||
|
|
@ -73,7 +73,7 @@ export class DataOptionController extends Controller {
|
|||
}
|
||||
|
||||
if (!result) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลความรู้ที่ตรงกับตำแหน่ง");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลความรู้ที่ตรงกับตำแหน่ง");
|
||||
}
|
||||
|
||||
const knowledges = await this.knowledgeRepository.find({
|
||||
|
|
@ -112,7 +112,7 @@ export class DataOptionController extends Controller {
|
|||
});
|
||||
|
||||
if (!person) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
let result = await this.mapKnowledgeSkillRepository.findOne({
|
||||
|
|
@ -146,7 +146,7 @@ export class DataOptionController extends Controller {
|
|||
}
|
||||
|
||||
if (!result) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทักษะที่ตรงกับตำแหน่ง");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทักษะที่ตรงกับตำแหน่ง");
|
||||
}
|
||||
|
||||
const computerData = await this.skillRepository.findOne({
|
||||
|
|
@ -154,7 +154,7 @@ export class DataOptionController extends Controller {
|
|||
});
|
||||
|
||||
if (!computerData) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทักษะคอมพิวเตอร์");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทักษะคอมพิวเตอร์");
|
||||
}
|
||||
const computer = await {
|
||||
id: computerData.id,
|
||||
|
|
@ -177,7 +177,7 @@ export class DataOptionController extends Controller {
|
|||
});
|
||||
|
||||
if (!englishData) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทักษะภาษาอังกฤษ");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทักษะภาษาอังกฤษ");
|
||||
}
|
||||
|
||||
const english = await {
|
||||
|
|
@ -201,7 +201,7 @@ export class DataOptionController extends Controller {
|
|||
});
|
||||
|
||||
if (!informationData) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
const information = await {
|
||||
|
|
@ -224,7 +224,7 @@ export class DataOptionController extends Controller {
|
|||
where: { type: TypeSkill.RESOURSE, active: 1 },
|
||||
});
|
||||
if (!resourseData) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
const resourse = await {
|
||||
|
|
@ -267,7 +267,7 @@ export class DataOptionController extends Controller {
|
|||
});
|
||||
|
||||
if (!results) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
const result = await results.map((v) => ({
|
||||
|
|
@ -306,7 +306,7 @@ export class DataOptionController extends Controller {
|
|||
});
|
||||
|
||||
if (!person) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
const assign = await this.assignRepository.count({
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ export class EvaluateChairmanController extends Controller {
|
|||
},
|
||||
});
|
||||
if (!director) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล");
|
||||
}
|
||||
const director_id = director.personal_id;
|
||||
|
||||
|
|
@ -63,7 +63,7 @@ export class EvaluateChairmanController extends Controller {
|
|||
where: { id: assign_id },
|
||||
});
|
||||
if (!assign) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
|
||||
}
|
||||
|
||||
const profile = await (assign.profile
|
||||
|
|
@ -93,7 +93,7 @@ export class EvaluateChairmanController extends Controller {
|
|||
});
|
||||
|
||||
if (!directorData) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล ผู้บังคับบัญชาและประธาน");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล ผู้บังคับบัญชาและประธาน");
|
||||
}
|
||||
|
||||
let mentors = "";
|
||||
|
|
@ -143,7 +143,7 @@ export class EvaluateChairmanController extends Controller {
|
|||
},
|
||||
});
|
||||
if (!director) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล");
|
||||
}
|
||||
const director_id = director.personal_id;
|
||||
let evaluate: any = null;
|
||||
|
|
@ -165,14 +165,14 @@ export class EvaluateChairmanController extends Controller {
|
|||
}
|
||||
|
||||
if (!evaluate) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบประเมิน");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบประเมิน");
|
||||
}
|
||||
|
||||
const assign = await this.assignRepository.findOne({
|
||||
where: { id: assign_id },
|
||||
});
|
||||
if (!assign) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
|
||||
}
|
||||
|
||||
const experimenteeData = await this.personalRepository.find({
|
||||
|
|
@ -199,7 +199,7 @@ export class EvaluateChairmanController extends Controller {
|
|||
});
|
||||
|
||||
if (!directorData) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล ผู้บังคับบัญชาและประธาน");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล ผู้บังคับบัญชาและประธาน");
|
||||
}
|
||||
|
||||
let mentors = "";
|
||||
|
|
@ -250,7 +250,7 @@ export class EvaluateChairmanController extends Controller {
|
|||
},
|
||||
});
|
||||
if (!director) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล");
|
||||
}
|
||||
|
||||
const director_id = director.personal_id;
|
||||
|
|
@ -260,7 +260,7 @@ export class EvaluateChairmanController extends Controller {
|
|||
where: { id: assign_id },
|
||||
});
|
||||
if (!assign) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
|
||||
}
|
||||
|
||||
const postData: any = await {
|
||||
|
|
@ -335,7 +335,7 @@ export class EvaluateChairmanController extends Controller {
|
|||
const before = evaluate;
|
||||
|
||||
if (!evaluate) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการประเมิน");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการประเมิน");
|
||||
}
|
||||
|
||||
evaluate.chairman_dated = requestBody.chairman_dated;
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ export class EvaluateController extends Controller {
|
|||
},
|
||||
});
|
||||
if (!director) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล");
|
||||
}
|
||||
const director_id = director.personal_id;
|
||||
|
||||
|
|
@ -63,7 +63,7 @@ export class EvaluateController extends Controller {
|
|||
where: { id: assign_id },
|
||||
});
|
||||
if (!assign) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
|
||||
}
|
||||
|
||||
const profile = await (assign.profile
|
||||
|
|
@ -126,7 +126,7 @@ export class EvaluateController extends Controller {
|
|||
},
|
||||
});
|
||||
if (!director) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล");
|
||||
}
|
||||
const director_id = director.personal_id;
|
||||
let evaluate: any = null;
|
||||
|
|
@ -148,14 +148,14 @@ export class EvaluateController extends Controller {
|
|||
}
|
||||
|
||||
if (!evaluate) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบประเมิน");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบประเมิน");
|
||||
}
|
||||
|
||||
const assign = await this.assignRepository.findOne({
|
||||
where: { id: assign_id },
|
||||
});
|
||||
if (!assign) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
|
||||
}
|
||||
|
||||
// const profile = await (assign.profile
|
||||
|
|
@ -241,7 +241,7 @@ export class EvaluateController extends Controller {
|
|||
},
|
||||
});
|
||||
if (!director) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล");
|
||||
}
|
||||
|
||||
const director_id = director.personal_id;
|
||||
|
|
@ -251,7 +251,7 @@ export class EvaluateController extends Controller {
|
|||
where: { id: assign_id },
|
||||
});
|
||||
if (!assign) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
|
||||
}
|
||||
|
||||
const postData: any = await {
|
||||
|
|
@ -326,7 +326,7 @@ export class EvaluateController extends Controller {
|
|||
const before = evaluate;
|
||||
|
||||
if (!evaluate) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการประเมิน");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการประเมิน");
|
||||
}
|
||||
|
||||
evaluate.commander_dated = requestBody.commander_dated;
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ export class EvaluateRecordController extends Controller {
|
|||
});
|
||||
|
||||
if (!directorData) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
const director = await {
|
||||
|
|
@ -77,7 +77,7 @@ export class EvaluateRecordController extends Controller {
|
|||
});
|
||||
|
||||
if (!assign) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
|
||||
}
|
||||
|
||||
const profileData = await this.personalRepository.findOne({
|
||||
|
|
@ -95,7 +95,7 @@ export class EvaluateRecordController extends Controller {
|
|||
},
|
||||
});
|
||||
if (!profileData) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลบุคคล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลบุคคล");
|
||||
}
|
||||
|
||||
const profile = await {
|
||||
|
|
@ -132,7 +132,7 @@ export class EvaluateRecordController extends Controller {
|
|||
});
|
||||
|
||||
if (!commanderData) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้บังคับบัญชา");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้บังคับบัญชา");
|
||||
}
|
||||
|
||||
const commander = await {
|
||||
|
|
@ -168,7 +168,7 @@ export class EvaluateRecordController extends Controller {
|
|||
},
|
||||
});
|
||||
if (!director) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล");
|
||||
}
|
||||
|
||||
const director_id = director.personal_id;
|
||||
|
|
@ -185,7 +185,7 @@ export class EvaluateRecordController extends Controller {
|
|||
});
|
||||
|
||||
if (!evaluate) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบประเมิน");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบประเมิน");
|
||||
}
|
||||
|
||||
const achievementData = await this.evaluateAchievementRepository.find({
|
||||
|
|
@ -196,7 +196,7 @@ export class EvaluateRecordController extends Controller {
|
|||
order: { output_id: "ASC" },
|
||||
});
|
||||
if (!achievementData) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
const achievements = await achievementData.map((achievement) => {
|
||||
|
|
@ -258,7 +258,7 @@ export class EvaluateRecordController extends Controller {
|
|||
});
|
||||
|
||||
if (!evaluate) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
await Promise.all(
|
||||
|
|
@ -336,7 +336,7 @@ export class EvaluateRecordController extends Controller {
|
|||
});
|
||||
|
||||
if (!assign) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
|
||||
}
|
||||
|
||||
const experimenteeData = await this.personalRepository.find({
|
||||
|
|
@ -397,7 +397,7 @@ export class EvaluateRecordController extends Controller {
|
|||
},
|
||||
});
|
||||
if (!director) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล");
|
||||
}
|
||||
|
||||
const director_id = director.personal_id;
|
||||
|
|
@ -407,7 +407,7 @@ export class EvaluateRecordController extends Controller {
|
|||
where: { id: assign_id },
|
||||
});
|
||||
if (!assign) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
|
||||
}
|
||||
|
||||
const postData: any = await {
|
||||
|
|
@ -513,7 +513,7 @@ export class EvaluateRecordController extends Controller {
|
|||
},
|
||||
});
|
||||
if (!director) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล");
|
||||
}
|
||||
|
||||
const director_id = director.personal_id;
|
||||
|
|
@ -525,7 +525,7 @@ export class EvaluateRecordController extends Controller {
|
|||
const before = evaluate;
|
||||
|
||||
if (!evaluate) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการประเมิน");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการประเมิน");
|
||||
}
|
||||
|
||||
evaluate.assessor_dated = requestBody.assessor_dated;
|
||||
|
|
@ -618,7 +618,7 @@ export class EvaluateRecordController extends Controller {
|
|||
});
|
||||
|
||||
if (!directorData) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
const director = await {
|
||||
|
|
@ -636,7 +636,7 @@ export class EvaluateRecordController extends Controller {
|
|||
});
|
||||
|
||||
if (!assign) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
|
||||
}
|
||||
|
||||
const profileData = await this.personalRepository.findOne({
|
||||
|
|
@ -654,7 +654,7 @@ export class EvaluateRecordController extends Controller {
|
|||
},
|
||||
});
|
||||
if (!profileData) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลบุคคล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลบุคคล");
|
||||
}
|
||||
|
||||
const profile = await {
|
||||
|
|
@ -712,7 +712,7 @@ export class EvaluateRecordController extends Controller {
|
|||
},
|
||||
});
|
||||
if (!director) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล");
|
||||
}
|
||||
|
||||
const director_id = director.personal_id;
|
||||
|
|
@ -729,7 +729,7 @@ export class EvaluateRecordController extends Controller {
|
|||
});
|
||||
|
||||
if (!evaluate) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบประเมิน");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบประเมิน");
|
||||
}
|
||||
|
||||
const achievementData = await this.evaluateAchievementRepository.find({
|
||||
|
|
@ -740,7 +740,7 @@ export class EvaluateRecordController extends Controller {
|
|||
order: { output_id: "ASC" },
|
||||
});
|
||||
if (!achievementData) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
const achievements = await achievementData.map((achievement) => {
|
||||
|
|
@ -802,7 +802,7 @@ export class EvaluateRecordController extends Controller {
|
|||
});
|
||||
|
||||
if (!evaluate) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
await Promise.all(
|
||||
|
|
@ -880,7 +880,7 @@ export class EvaluateRecordController extends Controller {
|
|||
});
|
||||
|
||||
if (!assign) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
|
||||
}
|
||||
|
||||
const experimenteeData = await this.personalRepository.find({
|
||||
|
|
@ -941,7 +941,7 @@ export class EvaluateRecordController extends Controller {
|
|||
},
|
||||
});
|
||||
if (!director) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล");
|
||||
}
|
||||
|
||||
const director_id = director.personal_id;
|
||||
|
|
@ -951,7 +951,7 @@ export class EvaluateRecordController extends Controller {
|
|||
where: { id: assign_id },
|
||||
});
|
||||
if (!assign) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
|
||||
}
|
||||
|
||||
const postData: any = await {
|
||||
|
|
@ -1054,7 +1054,7 @@ export class EvaluateRecordController extends Controller {
|
|||
},
|
||||
});
|
||||
if (!director) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล");
|
||||
}
|
||||
|
||||
const director_id = director.personal_id;
|
||||
|
|
@ -1064,7 +1064,7 @@ export class EvaluateRecordController extends Controller {
|
|||
});
|
||||
|
||||
if (!evaluate) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการประเมิน");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการประเมิน");
|
||||
}
|
||||
const before = evaluate;
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ export class EvaluateResultController extends Controller {
|
|||
where: { id: assign_id },
|
||||
});
|
||||
if (!assign) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
|
||||
}
|
||||
|
||||
const profile = await (assign.profile
|
||||
|
|
@ -71,7 +71,7 @@ export class EvaluateResultController extends Controller {
|
|||
});
|
||||
|
||||
if (!directorData) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล ผู้บังคับบัญชาและประธาน");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล ผู้บังคับบัญชาและประธาน");
|
||||
}
|
||||
|
||||
let mentors = "";
|
||||
|
|
@ -105,7 +105,7 @@ export class EvaluateResultController extends Controller {
|
|||
});
|
||||
|
||||
if (!resultData) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการประเมินผล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการประเมินผล");
|
||||
}
|
||||
|
||||
const develop_complete = await (resultData.develop_orientation_score > 0 &&
|
||||
|
|
@ -148,7 +148,7 @@ export class EvaluateResultController extends Controller {
|
|||
},
|
||||
});
|
||||
if (!director) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล");
|
||||
}
|
||||
const director_id = director.personal_id;
|
||||
|
||||
|
|
@ -160,14 +160,14 @@ export class EvaluateResultController extends Controller {
|
|||
});
|
||||
|
||||
if (!evaluate) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบประเมิน");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบประเมิน");
|
||||
}
|
||||
|
||||
const assign = await this.assignRepository.findOne({
|
||||
where: { id: assign_id },
|
||||
});
|
||||
if (!assign) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
|
||||
}
|
||||
|
||||
const experimenteeData = await this.personalRepository.find({
|
||||
|
|
@ -194,7 +194,7 @@ export class EvaluateResultController extends Controller {
|
|||
});
|
||||
|
||||
if (!directorData) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล ผู้บังคับบัญชาและประธาน");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล ผู้บังคับบัญชาและประธาน");
|
||||
}
|
||||
|
||||
let mentors = "";
|
||||
|
|
@ -245,7 +245,7 @@ export class EvaluateResultController extends Controller {
|
|||
},
|
||||
});
|
||||
if (!director) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล");
|
||||
}
|
||||
|
||||
const director_id = director.personal_id;
|
||||
|
|
@ -255,7 +255,7 @@ export class EvaluateResultController extends Controller {
|
|||
where: { id: assign_id },
|
||||
});
|
||||
if (!assign) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
|
||||
}
|
||||
|
||||
const postData: any = await {
|
||||
|
|
@ -283,7 +283,7 @@ export class EvaluateResultController extends Controller {
|
|||
});
|
||||
|
||||
if (!personal) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลบุคคล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลบุคคล");
|
||||
}
|
||||
personal.probation_status =
|
||||
requestBody.pass_result == 1
|
||||
|
|
@ -335,7 +335,7 @@ export class EvaluateResultController extends Controller {
|
|||
const before = evaluate;
|
||||
|
||||
if (!evaluate) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการประเมิน");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการประเมิน");
|
||||
}
|
||||
|
||||
evaluate.date_start = requestBody.start_date;
|
||||
|
|
@ -359,14 +359,14 @@ export class EvaluateResultController extends Controller {
|
|||
where: { id: assign_id },
|
||||
});
|
||||
if (!assign) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
|
||||
}
|
||||
const personal = await this.personalRepository.findOne({
|
||||
where: { personal_id: assign.personal_id },
|
||||
});
|
||||
|
||||
if (!personal) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลบุคคล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลบุคคล");
|
||||
}
|
||||
personal.probation_status =
|
||||
requestBody.pass_result == 1
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ export class PersonalController extends Controller {
|
|||
where: { personal_id: requestBody.id },
|
||||
});
|
||||
if (checkPersonal > 0) {
|
||||
return new HttpError(HttpStatusCode.BAD_REQUEST, "ผู้ทดลองปฏิบัติหน้าที่ราชการนี้มีอยู่แล้ว");
|
||||
throw new HttpError(HttpStatusCode.BAD_REQUEST, "ผู้ทดลองปฏิบัติหน้าที่ราชการนี้มีอยู่แล้ว");
|
||||
}
|
||||
|
||||
let organization = await (requestBody.orgChild4Name ? requestBody.orgChild4Name + "/" : "");
|
||||
|
|
@ -100,7 +100,7 @@ export class PersonalController extends Controller {
|
|||
});
|
||||
|
||||
if (!lists) {
|
||||
return new HttpError(HttpStatusCode.INTERNAL_SERVER_ERROR, "ไม่สามารถแสดงข้อมูลได้");
|
||||
throw new HttpError(HttpStatusCode.INTERNAL_SERVER_ERROR, "ไม่สามารถแสดงข้อมูลได้");
|
||||
}
|
||||
|
||||
let result: any = [];
|
||||
|
|
@ -143,7 +143,7 @@ export class PersonalController extends Controller {
|
|||
});
|
||||
|
||||
if (!person) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลบุคคล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลบุคคล");
|
||||
}
|
||||
|
||||
const probation_no = await this.assignRepository.count({
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ export class ReportController extends Controller {
|
|||
});
|
||||
|
||||
if (!evaluate || !result) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผลการทดลองปฏิบัติราชการ");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผลการทดลองปฏิบัติราชการ");
|
||||
}
|
||||
|
||||
const develop_total_score = await (Number(evaluate.develop_orientation_score) +
|
||||
|
|
@ -205,7 +205,7 @@ export class ReportController extends Controller {
|
|||
const before = personal;
|
||||
|
||||
if (!personal) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลบุคคล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลบุคคล");
|
||||
}
|
||||
|
||||
personal.order_number = requestBody.command_no;
|
||||
|
|
@ -256,7 +256,7 @@ export class ReportController extends Controller {
|
|||
const before = personal;
|
||||
|
||||
if (!personal) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลบุคคล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลบุคคล");
|
||||
}
|
||||
|
||||
personal.probation_status = await reqBody.status;
|
||||
|
|
@ -282,7 +282,7 @@ export class ReportController extends Controller {
|
|||
});
|
||||
|
||||
if (!evaluate) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
const directorData = await this.assignDirectorRepository.findOne({
|
||||
|
|
@ -291,7 +291,7 @@ export class ReportController extends Controller {
|
|||
});
|
||||
|
||||
if (!directorData) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
const director = await {
|
||||
|
|
@ -306,7 +306,7 @@ export class ReportController extends Controller {
|
|||
});
|
||||
|
||||
if (!achievements) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
let achievement: any = [];
|
||||
|
|
@ -516,7 +516,7 @@ export class ReportController extends Controller {
|
|||
});
|
||||
|
||||
if (!assign) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
const experimenteeData = await this.personalRepository.findOne({
|
||||
|
|
@ -526,7 +526,7 @@ export class ReportController extends Controller {
|
|||
});
|
||||
|
||||
if (!experimenteeData) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
const experimentee = await {
|
||||
|
|
@ -562,7 +562,7 @@ export class ReportController extends Controller {
|
|||
});
|
||||
|
||||
if (!evaluate) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
const evaluateData = await {
|
||||
|
|
@ -747,7 +747,7 @@ export class ReportController extends Controller {
|
|||
});
|
||||
|
||||
if (!assign) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
const experimenteeData = await this.personalRepository.findOne({
|
||||
|
|
@ -757,7 +757,7 @@ export class ReportController extends Controller {
|
|||
});
|
||||
|
||||
if (!experimenteeData) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
const experimentee = await {
|
||||
|
|
@ -786,7 +786,7 @@ export class ReportController extends Controller {
|
|||
});
|
||||
|
||||
if (!commanderData) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
const commander = await {
|
||||
|
|
@ -816,7 +816,7 @@ export class ReportController extends Controller {
|
|||
});
|
||||
|
||||
if (!evaluate) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
const develop_total_score = await (Number(evaluate.develop_orientation_score) +
|
||||
|
|
@ -1011,7 +1011,7 @@ export class ReportController extends Controller {
|
|||
});
|
||||
|
||||
if (!assign) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
const experimenteeData = await this.personalRepository.findOne({
|
||||
|
|
@ -1021,7 +1021,7 @@ export class ReportController extends Controller {
|
|||
});
|
||||
|
||||
if (!experimenteeData) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
const experimentee = await {
|
||||
|
|
@ -1041,7 +1041,7 @@ export class ReportController extends Controller {
|
|||
});
|
||||
|
||||
if (!directorData) {
|
||||
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
const director = await Promise.all(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue