Merge branch 'develop' of github.com:Frappet/bma-ehr-organization into develop

# Conflicts:
#	src/controllers/PositionController.ts
This commit is contained in:
Kittapath 2024-03-04 15:36:39 +07:00
commit 391c98682f
9 changed files with 12 additions and 13 deletions

View file

@ -127,7 +127,7 @@ export class BloodGroupController extends Controller {
select: ["id", "name"], select: ["id", "name"],
}); });
if (!bloodGroup) { if (!bloodGroup) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลกรุ๊ปเลือดนี้");
} }
return new HttpSuccess(bloodGroup); return new HttpSuccess(bloodGroup);
} }

View file

@ -134,7 +134,7 @@ export class EducationLevelController extends Controller {
], ],
}); });
if (!educationLevel) { if (!educationLevel) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลระดับการศึกษานี้");
} }
return new HttpSuccess(educationLevel); return new HttpSuccess(educationLevel);
} }

View file

@ -39,7 +39,6 @@ export class GenderController extends Controller {
*/ */
@Get() @Get()
async GetResult() { async GetResult() {
console.log("asds");
const _gender = await this.genderRepository.find({ const _gender = await this.genderRepository.find({
select: ["id", "name", "createdAt", "lastUpdatedAt", "createdFullName", "lastUpdateFullName"], select: ["id", "name", "createdAt", "lastUpdatedAt", "createdFullName", "lastUpdateFullName"],
order: { createdAt: "ASC" }, order: { createdAt: "ASC" },
@ -64,7 +63,7 @@ export class GenderController extends Controller {
select: ["id", "name"], select: ["id", "name"],
}); });
if (!_gender) { if (!_gender) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลสถานภาพทางเพศนี้");
} }
return new HttpSuccess(_gender); return new HttpSuccess(_gender);
@ -84,7 +83,7 @@ export class GenderController extends Controller {
) { ) {
const _gender = Object.assign(new Gender(), requestBody); const _gender = Object.assign(new Gender(), requestBody);
if (!_gender) { if (!_gender) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลสถานภาพทางเพศนี้");
} }
const checkName = await this.genderRepository.findOne({ const checkName = await this.genderRepository.findOne({
@ -119,7 +118,7 @@ export class GenderController extends Controller {
) { ) {
const _gender = await this.genderRepository.findOne({ where: { id: id } }); const _gender = await this.genderRepository.findOne({ where: { id: id } });
if (!_gender) { if (!_gender) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลเพศนี้"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลสถานภาพทางเพศนี้");
} }
const checkName = await this.genderRepository.findOne({ const checkName = await this.genderRepository.findOne({
where: { id: Not(id), name: requestBody.name }, where: { id: Not(id), name: requestBody.name },
@ -148,7 +147,7 @@ export class GenderController extends Controller {
where: { id: id }, where: { id: id },
}); });
if (!_delGender) { if (!_delGender) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลเพศนี้"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลสถานภาพทางเพศนี้");
} }
await this.genderRepository.delete(_delGender.id); await this.genderRepository.delete(_delGender.id);
return new HttpSuccess(); return new HttpSuccess();

View file

@ -58,7 +58,7 @@ export class OrgChild1Controller {
relations: ["orgRoot"], relations: ["orgRoot"],
}); });
if (!orgChild1) { if (!orgChild1) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล โครงสร้างระดับ 1"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลโครงสร้างระดับ 1");
} }
const getOrgChild1 = { const getOrgChild1 = {
orgChild1Id: orgChild1.id, orgChild1Id: orgChild1.id,

View file

@ -60,7 +60,7 @@ export class OrgChild2Controller extends Controller {
relations: ["orgRoot", "orgChild1"], relations: ["orgRoot", "orgChild1"],
}); });
if (!orgChild2) { if (!orgChild2) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล โครงสร้างระดับ 2"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลโครงสร้างระดับ 2");
} }
const getOrgChild2 = { const getOrgChild2 = {
orgChild2Id: orgChild2.id, orgChild2Id: orgChild2.id,

View file

@ -56,7 +56,7 @@ export class OrgChild3Controller {
relations: ["orgRoot", "orgChild1", "orgChild2"], relations: ["orgRoot", "orgChild1", "orgChild2"],
}); });
if (!orgChild3) { if (!orgChild3) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล โครงสร้างระดับ 3"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลโครงสร้างระดับ 3");
} }
const getOrgChild3 = { const getOrgChild3 = {
orgChild3Id: orgChild3.id, orgChild3Id: orgChild3.id,

View file

@ -58,7 +58,7 @@ export class OrgChild4Controller extends Controller {
relations: ["orgRoot", "orgChild1", "orgChild2", "orgChild3"], relations: ["orgRoot", "orgChild1", "orgChild2", "orgChild3"],
}); });
if (!orgChild4) { if (!orgChild4) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล โครงสร้างระดับ 4"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลโครงสร้างระดับ 4");
} }
const getOrgChild4 = { const getOrgChild4 = {
orgChild4Id: orgChild4.id, orgChild4Id: orgChild4.id,

View file

@ -51,7 +51,7 @@ export class OrgRootController extends Controller {
async GetRoot(@Path() id: string) { async GetRoot(@Path() id: string) {
const orgRoot = await this.orgRootRepository.findOne({ where: { id } }); const orgRoot = await this.orgRootRepository.findOne({ where: { id } });
if (!orgRoot) { if (!orgRoot) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล โครงสร้างระดับ Root"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลโครงสร้างระดับ Root นี้");
} }
const getOrgRoot = { const getOrgRoot = {
orgRootId: orgRoot.id, orgRootId: orgRoot.id,

View file

@ -89,7 +89,7 @@ export class PositionController extends Controller {
where: { id: posDict.posTypeId }, where: { id: posDict.posTypeId },
}); });
if (!checkPosTypeId) { if (!checkPosTypeId) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล PosTypeId"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลประเภทตำแหน่ง");
} }
const checkPosLevelId = await this.posLevelRepository.findOne({ const checkPosLevelId = await this.posLevelRepository.findOne({