@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
This commit is contained in:
kittapath 2024-10-18 10:00:53 +07:00
parent f51adcc8cb
commit ce5c56bfca
33 changed files with 22 additions and 55 deletions

View file

@ -28,7 +28,6 @@ import { RequestWithUser } from "../middlewares/user";
HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class BloodGroupController extends Controller {
private bloodGroupRepository = AppDataSource.getRepository(BloodGroup);

View file

@ -44,7 +44,6 @@ import CallAPI from "../interfaces/call-api";
HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class ChangePositionController extends Controller {
private changePositionRepository = AppDataSource.getRepository(ChangePosition);
private profileChangePositionRepository = AppDataSource.getRepository(ProfileChangePosition);

View file

@ -64,7 +64,6 @@ import permission from "../interfaces/permission";
HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class CommandController extends Controller {
private commandRepository = AppDataSource.getRepository(Command);
private commandTypeRepository = AppDataSource.getRepository(CommandType);

View file

@ -29,7 +29,6 @@ import { CommandSys } from "../entities/CommandSys";
HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class CommandSalaryController extends Controller {
private commandSalaryRepository = AppDataSource.getRepository(CommandSalary);
private commandSysRepository = AppDataSource.getRepository(CommandSys);

View file

@ -26,7 +26,6 @@ import { CommandSys, CreateCommandSys, UpdateCommandSys } from "../entities/Comm
HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class CommandSysController extends Controller {
private commandSysRepository = AppDataSource.getRepository(CommandSys);

View file

@ -29,7 +29,6 @@ import { CommandSys } from "../entities/CommandSys";
HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class CommandTypeController extends Controller {
private commandTypeRepository = AppDataSource.getRepository(CommandType);
private commandSysRepository = AppDataSource.getRepository(CommandSys);

View file

@ -30,7 +30,6 @@ import { RequestWithUser } from "../middlewares/user";
HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class DistrictController extends Controller {
private districtRepository = AppDataSource.getRepository(District);
private provinceRepository = AppDataSource.getRepository(Province);

View file

@ -28,7 +28,6 @@ import { setLogDataDiff } from "../interfaces/utils";
HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class EducationLevelController extends Controller {
private educationLevelRepository = AppDataSource.getRepository(EducationLevel);

View file

@ -33,7 +33,6 @@ import { EmployeePosDict } from "../entities/EmployeePosDict";
HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class EmployeePosLevelController extends Controller {
private employeePosDictRepository = AppDataSource.getRepository(EmployeePosDict);
private employeePosTypeRepository = AppDataSource.getRepository(EmployeePosType);

View file

@ -35,7 +35,6 @@ import { setLogDataDiff } from "../interfaces/utils";
HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class EmployeePosTypeController extends Controller {
private employeePosDictRepository = AppDataSource.getRepository(EmployeePosDict);
private employeePosTypeRepository = AppDataSource.getRepository(EmployeePosType);
@ -81,8 +80,8 @@ export class EmployeePosTypeController extends Controller {
EmpPosType.lastUpdateFullName = request.user.name;
EmpPosType.createdAt = new Date();
EmpPosType.lastUpdatedAt = new Date();
await this.employeePosTypeRepository.save(EmpPosType, {data: request});
setLogDataDiff(request, {before, after: EmpPosType});
await this.employeePosTypeRepository.save(EmpPosType, { data: request });
setLogDataDiff(request, { before, after: EmpPosType });
return new HttpSuccess(EmpPosType.id);
}
@ -129,8 +128,8 @@ export class EmployeePosTypeController extends Controller {
EmpPosType.lastUpdateFullName = request.user.name;
EmpPosType.lastUpdatedAt = new Date();
this.employeePosTypeRepository.merge(EmpPosType, requestBody);
await this.employeePosTypeRepository.save(EmpPosType, {data: request});
setLogDataDiff(request, {before, after: EmpPosType});
await this.employeePosTypeRepository.save(EmpPosType, { data: request });
setLogDataDiff(request, { before, after: EmpPosType });
return new HttpSuccess(EmpPosType.id);
}
@ -147,8 +146,8 @@ export class EmployeePosTypeController extends Controller {
try {
result = await this.employeePosTypeRepository.findOne({
where: { id: id },
})
await this.employeePosTypeRepository.remove(result, {data: request});
});
await this.employeePosTypeRepository.remove(result, { data: request });
} catch {
throw new HttpError(
HttpStatusCode.NOT_FOUND,

View file

@ -48,7 +48,6 @@ import { after } from "node:test";
HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class EmployeePositionController extends Controller {
private employeePosDictRepository = AppDataSource.getRepository(EmployeePosDict);
private employeePosTypeRepository = AppDataSource.getRepository(EmployeePosType);
@ -169,8 +168,8 @@ export class EmployeePositionController extends Controller {
empPosDict.lastUpdateFullName = request.user.name;
empPosDict.lastUpdatedAt = new Date();
this.employeePosDictRepository.merge(empPosDict, requestBody);
await this.employeePosDictRepository.save(empPosDict,{data: request});
setLogDataDiff( request, { before, after: empPosDict });
await this.employeePosDictRepository.save(empPosDict, { data: request });
setLogDataDiff(request, { before, after: empPosDict });
return new HttpSuccess(empPosDict.id);
}

View file

@ -29,7 +29,6 @@ import { RequestWithUser } from "../middlewares/user";
HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class GenderController extends Controller {
private genderRepository = AppDataSource.getRepository(Gender);

View file

@ -32,7 +32,6 @@ import { RequestWithUser } from "../middlewares/user";
HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class InsigniaController extends Controller {
private insigniaTypeRepository = AppDataSource.getRepository(InsigniaType);
private insigniaRepository = AppDataSource.getRepository(Insignia);

View file

@ -33,7 +33,6 @@ import { setLogDataDiff } from "../interfaces/utils";
HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class InsigniaTypeController extends Controller {
private insigniaTypeRepository = AppDataSource.getRepository(InsigniaType);
private insigniaRepository = AppDataSource.getRepository(Insignia);
@ -110,7 +109,7 @@ export class InsigniaTypeController extends Controller {
insigniaType.lastUpdatedAt = new Date();
this.insigniaTypeRepository.merge(insigniaType, requestBody);
await this.insigniaTypeRepository.save(insigniaType, { data: request });
setLogDataDiff( request, { before, after: insigniaType });
setLogDataDiff(request, { before, after: insigniaType });
return new HttpSuccess(insigniaType.id);
}
@ -136,7 +135,7 @@ export class InsigniaTypeController extends Controller {
"ไม่สามารถลบได้ เนื่องจากพบข้อมูลที่ตารางเครื่องราชอิสริยาภรณ์",
);
}
await this.insigniaTypeRepository.remove(delInsigniaType, {data: request});
await this.insigniaTypeRepository.remove(delInsigniaType, { data: request });
return new HttpSuccess();
}

View file

@ -39,7 +39,6 @@ import { setLogDataDiff } from "../interfaces/utils";
HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class OrgChild1Controller {
private orgRootRepository = AppDataSource.getRepository(OrgRoot);
private child1Repository = AppDataSource.getRepository(OrgChild1);

View file

@ -40,7 +40,6 @@ import { setLogDataDiff } from "../interfaces/utils";
HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class OrgChild2Controller extends Controller {
private orgRootRepository = AppDataSource.getRepository(OrgRoot);
private child1Repository = AppDataSource.getRepository(OrgChild1);

View file

@ -37,7 +37,6 @@ import { setLogDataDiff } from "../interfaces/utils";
HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class OrgChild3Controller {
private orgRootRepository = AppDataSource.getRepository(OrgRoot);
private child2Repository = AppDataSource.getRepository(OrgChild2);

View file

@ -40,7 +40,6 @@ import { setLogDataDiff } from "../interfaces/utils";
HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class OrgChild4Controller extends Controller {
private orgRootRepository = AppDataSource.getRepository(OrgRoot);
private child3Repository = AppDataSource.getRepository(OrgChild3);

View file

@ -42,7 +42,6 @@ import { AuthRole } from "../entities/AuthRole";
HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class OrganizationController extends Controller {
private orgRevisionRepository = AppDataSource.getRepository(OrgRevision);
private permissionOrgRepository = AppDataSource.getRepository(PermissionOrg);

View file

@ -18,7 +18,6 @@ import { ProfileEmployee } from "../entities/ProfileEmployee";
HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class OrganizationUnauthorizeController extends Controller {
private orgRevisionRepository = AppDataSource.getRepository(OrgRevision);
private orgRootRepository = AppDataSource.getRepository(OrgRoot);

View file

@ -38,7 +38,6 @@ import { setLogDataDiff } from "../interfaces/utils";
HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class PermissionOrgController extends Controller {
private orgRootRepository = AppDataSource.getRepository(OrgRoot);
private profileRepository = AppDataSource.getRepository(Profile);
@ -481,7 +480,7 @@ export class PermissionOrgController extends Controller {
_permissionOrg.lastUpdateFullName = request.user.name;
_permissionOrg.createdAt = new Date();
_permissionOrg.lastUpdatedAt = new Date();
await this.permissionOrgRepository.save(_permissionOrg, {data:request});
await this.permissionOrgRepository.save(_permissionOrg, { data: request });
setLogDataDiff(request, { before, after: _permissionOrg });
return new HttpSuccess();
}
@ -521,7 +520,7 @@ export class PermissionOrgController extends Controller {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบสิทธิ์นี้อยู่ในระบบแล้ว");
}
await this.permissionOrgRepository.remove(_delPermissionOrg, {data:req});
await this.permissionOrgRepository.remove(_delPermissionOrg, { data: req });
return new HttpSuccess();
}

View file

@ -31,7 +31,6 @@ import { setLogDataDiff } from "../interfaces/utils";
HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class PosExecutiveController extends Controller {
private posExecutiveRepository = AppDataSource.getRepository(PosExecutive);
private positionRepository = AppDataSource.getRepository(Position);
@ -85,8 +84,8 @@ export class PosExecutiveController extends Controller {
posExecutive.lastUpdateFullName = request.user.name;
posExecutive.createdAt = new Date();
posExecutive.lastUpdatedAt = new Date();
await this.posExecutiveRepository.save(posExecutive, {data: request});
setLogDataDiff(request, {before, after: posExecutive});
await this.posExecutiveRepository.save(posExecutive, { data: request });
setLogDataDiff(request, { before, after: posExecutive });
return new HttpSuccess(posExecutive.id);
}
@ -147,8 +146,8 @@ export class PosExecutiveController extends Controller {
posExecutive.lastUpdateFullName = request.user.name;
posExecutive.lastUpdatedAt = new Date();
// this.posExecutiveRepository.merge(posExecutive, requestBody);
await this.posExecutiveRepository.save(posExecutive, {data: request});
setLogDataDiff(request, {before, after: posExecutive});
await this.posExecutiveRepository.save(posExecutive, { data: request });
setLogDataDiff(request, { before, after: posExecutive });
return new HttpSuccess();
}

View file

@ -31,7 +31,6 @@ import { Not } from "typeorm";
HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class PosLevelController extends Controller {
private posTypeRepository = AppDataSource.getRepository(PosType);
private posLevelRepository = AppDataSource.getRepository(PosLevel);

View file

@ -30,7 +30,6 @@ import Extension from "../interfaces/extension";
HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class PosMasterActController extends Controller {
private orgRevisionRepository = AppDataSource.getRepository(OrgRevision);
private posMasterActRepository = AppDataSource.getRepository(PosMasterAct);

View file

@ -33,7 +33,6 @@ import { RequestWithUser } from "../middlewares/user";
HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class PosTypeController extends Controller {
private posTypeRepository = AppDataSource.getRepository(PosType);
private posLevelRepository = AppDataSource.getRepository(PosLevel);
@ -73,8 +72,8 @@ export class PosTypeController extends Controller {
posType.lastUpdateFullName = request.user.name;
posType.createdAt = new Date();
posType.lastUpdatedAt = new Date();
await this.posTypeRepository.save(posType, {data: request});
setLogDataDiff(request, {before , after: posType});
await this.posTypeRepository.save(posType, { data: request });
setLogDataDiff(request, { before, after: posType });
return new HttpSuccess(posType);
}
@ -113,8 +112,8 @@ export class PosTypeController extends Controller {
posType.lastUpdateFullName = request.user.name;
posType.lastUpdatedAt = new Date();
this.posTypeRepository.merge(posType, requestBody);
await this.posTypeRepository.save(posType, {data: request});
setLogDataDiff(request,{ before, after:posType });
await this.posTypeRepository.save(posType, { data: request });
setLogDataDiff(request, { before, after: posType });
return new HttpSuccess(posType.id);
}
@ -130,10 +129,10 @@ export class PosTypeController extends Controller {
let result: any;
try {
result = await this.posTypeRepository.findOne({ where: { id } });
if(!result){
if (!result) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลประเภทตำแหน่งนี้");
}
await this.posTypeRepository.remove(result, {data: result});
await this.posTypeRepository.remove(result, { data: result });
} catch {
throw new HttpError(
HttpStatusCode.NOT_FOUND,

View file

@ -52,7 +52,6 @@ import { Assign } from "../entities/Assign";
HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class PositionController extends Controller {
private posExecutiveRepository = AppDataSource.getRepository(PosExecutive);
private posTypeRepository = AppDataSource.getRepository(PosType);

View file

@ -30,7 +30,6 @@ import { request } from "axios";
HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class PrefixController extends Controller {
private prefixRepository = AppDataSource.getRepository(Prefixe);

View file

@ -29,7 +29,6 @@ import { RequestWithUser } from "../middlewares/user";
HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class ProvinceController extends Controller {
private provinceRepository = AppDataSource.getRepository(Province);

View file

@ -28,7 +28,6 @@ import { RequestWithUser } from "../middlewares/user";
HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class RankController extends Controller {
private rankRepository = AppDataSource.getRepository(Rank);

View file

@ -29,7 +29,6 @@ import { request } from "axios";
HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class RelationshipController extends Controller {
private relationshipRepository = AppDataSource.getRepository(Relationship);

View file

@ -28,7 +28,6 @@ import { RequestWithUser } from "../middlewares/user";
HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class ReligionController extends Controller {
private religionRepository = AppDataSource.getRepository(Religion);

View file

@ -18,7 +18,6 @@ import Extension from "../interfaces/extension";
HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class ReportController extends Controller {
private orgRevisionRepository = AppDataSource.getRepository(OrgRevision);
private orgRootRepository = AppDataSource.getRepository(OrgRoot);

View file

@ -30,7 +30,6 @@ import { setLogDataDiff } from "../interfaces/utils";
HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class SubDistrictController extends Controller {
private subDistrictRepository = AppDataSource.getRepository(SubDistrict);
private districtRepository = AppDataSource.getRepository(District);