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

This commit is contained in:
kittapath 2024-08-27 16:38:27 +07:00
commit 70e1ab9efd
3 changed files with 42 additions and 43 deletions

View file

@ -994,7 +994,7 @@ export class ProfileController extends Controller {
*/ */
@Get("commander/{profileId}") @Get("commander/{profileId}")
async getProfileCommanderUser(@Request() request: RequestWithUser, @Path() profileId: string) { async getProfileCommanderUser(@Request() request: RequestWithUser, @Path() profileId: string) {
await new permission().PermissionOrgUserGet(request, "SYS_REGISTRY_OFFICER", profileId); // await new permission().PermissionOrgUserGet(request, "SYS_REGISTRY_OFFICER", profileId);//ไม่แน่ใจOFFปิดไว้ก่อน
const profile = await this.profileRepo.findOne({ const profile = await this.profileRepo.findOne({
where: { id: profileId }, where: { id: profileId },
}); });
@ -2503,7 +2503,7 @@ export class ProfileController extends Controller {
@Get("history/{id}") @Get("history/{id}")
async getProfileHistory(@Path() id: string, @Request() req: RequestWithUser) { async getProfileHistory(@Path() id: string, @Request() req: RequestWithUser) {
await new permission().PermissionOrgUserList(req, "SYS_REGISTRY_OFFICER", id); // await new permission().PermissionOrgUserList(req, "SYS_REGISTRY_OFFICER", id);//ไม่แน่ใจOFFปิดไว้ก่อน
const profile = await this.profileHistoryRepo.find({ const profile = await this.profileHistoryRepo.find({
relations: { relations: {
posLevel: true, posLevel: true,
@ -3160,7 +3160,7 @@ export class ProfileController extends Controller {
*/ */
@Get("profileid/position/{id}") @Get("profileid/position/{id}")
async getProfileByProfileid(@Request() request: RequestWithUser, @Path() id: string) { async getProfileByProfileid(@Request() request: RequestWithUser, @Path() id: string) {
await new permission().PermissionOrgUserGet(request, "SYS_REGISTRY_OFFICER", id); // await new permission().PermissionOrgUserGet(request, "SYS_REGISTRY_OFFICER", id);//ไม่แน่ใจOFFปิดไว้ก่อน
const profile = await this.profileRepo.findOne({ const profile = await this.profileRepo.findOne({
where: { id: id }, where: { id: id },
relations: ["posLevel", "posType", "current_holders", "current_holders.orgRoot"], relations: ["posLevel", "posType", "current_holders", "current_holders.orgRoot"],
@ -3381,7 +3381,7 @@ export class ProfileController extends Controller {
if (!profile) { if (!profile) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลบุคคลนี้ในระบบ"); throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลบุคคลนี้ในระบบ");
} }
await new permission().PermissionOrgUserList(request, "SYS_REGISTRY_OFFICER", profile.id); // await new permission().PermissionOrgUserList(request, "SYS_REGISTRY_OFFICER", profile.id);//ไม่แน่ใจOFFปิดไว้ก่อน
return new HttpSuccess(profile); return new HttpSuccess(profile);
} }
@ -3401,7 +3401,7 @@ export class ProfileController extends Controller {
if (!profile) { if (!profile) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลบุคคลนี้ในระบบ"); throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลบุคคลนี้ในระบบ");
} }
await new permission().PermissionOrgUserList(request, "SYS_REGISTRY_OFFICER", profile.id); // await new permission().PermissionOrgUserList(request, "SYS_REGISTRY_OFFICER", profile.id);//ไม่แน่ใจOFFปิดไว้ก่อน
const orgRevisionPublish = await this.orgRevisionRepo const orgRevisionPublish = await this.orgRevisionRepo
.createQueryBuilder("orgRevision") .createQueryBuilder("orgRevision")
@ -3516,7 +3516,7 @@ export class ProfileController extends Controller {
*/ */
@Get("profileempid/position/{id}") @Get("profileempid/position/{id}")
async getProfileByProfileempid(@Request() request: RequestWithUser, @Path() id: string) { async getProfileByProfileempid(@Request() request: RequestWithUser, @Path() id: string) {
await new permission().PermissionOrgUserList(request, "SYS_REGISTRY_OFFICER", id); // await new permission().PermissionOrgUserList(request, "SYS_REGISTRY_OFFICER", id);//ไม่แน่ใจOFFปิดไว้ก่อน
const profile = await this.profileEmpRepo.findOne({ const profile = await this.profileEmpRepo.findOne({
where: { id: id }, where: { id: id },
relations: ["posLevel", "posType", "current_holders", "current_holders.orgRoot"], relations: ["posLevel", "posType", "current_holders", "current_holders.orgRoot"],

View file

@ -1313,7 +1313,7 @@ export class ProfileEmployeeController extends Controller {
@Get("history/{id}") @Get("history/{id}")
async getProfileHistory(@Path() id: string, @Request() req: RequestWithUser) { async getProfileHistory(@Path() id: string, @Request() req: RequestWithUser) {
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", id); // await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", id);ไม่แน่ใจEMPปิดไว้ก่อน
const profile = await this.profileHistoryRepo.find({ const profile = await this.profileHistoryRepo.find({
relations: { relations: {
posLevel: true, posLevel: true,
@ -2078,7 +2078,7 @@ export class ProfileEmployeeController extends Controller {
@Path() id: string, @Path() id: string,
@Body() body: UpdatePositionTempProfileEmployee, @Body() body: UpdatePositionTempProfileEmployee,
) { ) {
await new permission().PermissionOrgUserUpdate(request, "SYS_REGISTRY_EMP", id); // await new permission().PermissionOrgUserUpdate(request, "SYS_REGISTRY_EMP", id);//ไม่แน่ใจEMPปิดไว้ก่อน
if (body.posLevelId === "") body.posLevelId = null; if (body.posLevelId === "") body.posLevelId = null;
if (body.posTypeId === "") body.posTypeId = null; if (body.posTypeId === "") body.posTypeId = null;
@ -2212,7 +2212,6 @@ export class ProfileEmployeeController extends Controller {
@Body() @Body()
requestBody: { citizenId: string }, requestBody: { citizenId: string },
) { ) {
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", id);
const profile = await this.profileRepo.findOne({ const profile = await this.profileRepo.findOne({
where: { id: Not(id), citizenId: requestBody.citizenId }, where: { id: Not(id), citizenId: requestBody.citizenId },
}); });
@ -2863,7 +2862,7 @@ export class ProfileEmployeeController extends Controller {
where: { id: id }, where: { id: id },
}); });
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
await new permission().PermissionOrgUserUpdate(request, "SYS_REGISTRY_EMP", profile.id);//ไม่แน่ใจEMPปิดไว้ก่อน // await new permission().PermissionOrgUserUpdate(request, "SYS_REGISTRY_EMP", profile.id);//ไม่แน่ใจEMPปิดไว้ก่อน
profile.isLeave = requestBody.isLeave; profile.isLeave = requestBody.isLeave;
profile.leaveReason = requestBody.leaveReason; profile.leaveReason = requestBody.leaveReason;
@ -2894,7 +2893,7 @@ export class ProfileEmployeeController extends Controller {
@Path() profileEmployeeId: string, @Path() profileEmployeeId: string,
@Body() body: UpdateInformationProfileEmployee, @Body() body: UpdateInformationProfileEmployee,
) { ) {
await new permission().PermissionOrgUserUpdate(request, "SYS_REGISTRY_EMP", profileEmployeeId); // await new permission().PermissionOrgUserUpdate(request, "SYS_REGISTRY_EMP", profileEmployeeId);//ไม่แน่ใจEMPปิดไว้ก่อน
const profileEmp = await this.profileRepo.findOneBy({ id: profileEmployeeId }); const profileEmp = await this.profileRepo.findOneBy({ id: profileEmployeeId });
if (!profileEmp) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์นี้"); if (!profileEmp) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์นี้");
@ -2923,7 +2922,7 @@ export class ProfileEmployeeController extends Controller {
*/ */
@Get("information/{profileEmployeeId}") @Get("information/{profileEmployeeId}")
async getInformationById(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { async getInformationById(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileEmployeeId); // await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileEmployeeId);//ไม่แน่ใจEMPปิดไว้ก่อน
const profileInformation = await this.profileRepo.findOne({ const profileInformation = await this.profileRepo.findOne({
where: { id: profileEmployeeId }, where: { id: profileEmployeeId },
}); });
@ -2954,7 +2953,7 @@ export class ProfileEmployeeController extends Controller {
*/ */
@Get("information/history/{profileEmployeeId}") @Get("information/history/{profileEmployeeId}")
async getInformationHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) { async getInformationHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
await new permission().PermissionOrgUserList(req, "SYS_REGISTRY_EMP", profileEmployeeId); // await new permission().PermissionOrgUserList(req, "SYS_REGISTRY_EMP", profileEmployeeId);//ไม่แน่ใจEMPปิดไว้ก่อน
const profileInformation = await this.profileRepo.find({ const profileInformation = await this.profileRepo.find({
relations: { relations: {
information_histories: true, information_histories: true,
@ -2999,7 +2998,7 @@ export class ProfileEmployeeController extends Controller {
@Path() profileEmployeeId: string, @Path() profileEmployeeId: string,
@Request() req: RequestWithUser, @Request() req: RequestWithUser,
) { ) {
await new permission().PermissionOrgUserList(req, "SYS_REGISTRY_EMP", profileEmployeeId); // await new permission().PermissionOrgUserList(req, "SYS_REGISTRY_EMP", profileEmployeeId);//ไม่แน่ใจEMPปิดไว้ก่อน
const employment = await this.employmentRepository.find({ const employment = await this.employmentRepository.find({
where: { profileEmployeeId: profileEmployeeId }, where: { profileEmployeeId: profileEmployeeId },
order: { createdAt: "ASC" }, order: { createdAt: "ASC" },
@ -3024,13 +3023,13 @@ export class ProfileEmployeeController extends Controller {
const employment = await this.employmentRepository.findOne({ const employment = await this.employmentRepository.findOne({
where: { id: id }, where: { id: id },
}); });
if (employment) { // if (employment) {
await new permission().PermissionOrgUserGet( // await new permission().PermissionOrgUserGet(
req, // req,
"SYS_REGISTRY_EMP", // "SYS_REGISTRY_EMP",
employment.profileEmployeeId, // employment.profileEmployeeId,
); // );
} // }//ไม่แน่ใจEMPปิดไว้ก่อน
return new HttpSuccess(employment); return new HttpSuccess(employment);
} }
@ -3046,13 +3045,13 @@ export class ProfileEmployeeController extends Controller {
const employment = await this.employmentRepository.findOne({ const employment = await this.employmentRepository.findOne({
where: { id: id }, where: { id: id },
}); });
if (employment) { // if (employment) {
await new permission().PermissionOrgUserList( // await new permission().PermissionOrgUserList(
req, // req,
"SYS_REGISTRY_EMP", // "SYS_REGISTRY_EMP",
employment.profileEmployeeId, // employment.profileEmployeeId,
); // );
} // }//ไม่แน่ใจEMPปิดไว้ก่อน
const employmentHistory = await this.employmentHistoryRepository.find({ const employmentHistory = await this.employmentHistoryRepository.find({
where: { profileEmployeeEmploymentId: id }, where: { profileEmployeeEmploymentId: id },
order: { lastUpdatedAt: "ASC" }, order: { lastUpdatedAt: "ASC" },
@ -3077,7 +3076,7 @@ export class ProfileEmployeeController extends Controller {
where: { id: profileEmployeeId }, where: { id: profileEmployeeId },
}); });
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
await new permission().PermissionOrgUserList(request, "SYS_REGISTRY_EMP", profile.id); // await new permission().PermissionOrgUserList(request, "SYS_REGISTRY_EMP", profile.id);//ไม่แน่ใจEMPปิดไว้ก่อน
const employment = new ProfileEmployeeEmployment(); const employment = new ProfileEmployeeEmployment();
// const history = new ProfileEmployeeEmploymentHistory(); // const history = new ProfileEmployeeEmploymentHistory();
@ -3112,13 +3111,13 @@ export class ProfileEmployeeController extends Controller {
const employment = await this.employmentRepository.findOne({ const employment = await this.employmentRepository.findOne({
where: { id: id }, where: { id: id },
}); });
if (employment) { // if (employment) {
await new permission().PermissionOrgUserDelete( // await new permission().PermissionOrgUserDelete(
request, // request,
"SYS_REGISTRY_EMP", // "SYS_REGISTRY_EMP",
employment.profileEmployeeId, // employment.profileEmployeeId,
); // );
} // }//ไม่แน่ใจEMPปิดไว้ก่อน
await this.employmentHistoryRepository.delete({ await this.employmentHistoryRepository.delete({
profileEmployeeEmploymentId: id, profileEmployeeEmploymentId: id,
}); });
@ -3145,11 +3144,11 @@ export class ProfileEmployeeController extends Controller {
) { ) {
const employment = await this.employmentRepository.findOneBy({ id }); const employment = await this.employmentRepository.findOneBy({ id });
if (!employment) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); if (!employment) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
await new permission().PermissionOrgUserUpdate( // await new permission().PermissionOrgUserUpdate(
request, // request,
"SYS_REGISTRY_EMP", // "SYS_REGISTRY_EMP",
employment.profileEmployeeId, // employment.profileEmployeeId,
); // );//ไม่แน่ใจEMPปิดไว้ก่อน
const history = new ProfileEmployeeEmploymentHistory(); const history = new ProfileEmployeeEmploymentHistory();
Object.assign(history, { ...employment, id: undefined }); Object.assign(history, { ...employment, id: undefined });
@ -3439,7 +3438,7 @@ export class ProfileEmployeeController extends Controller {
if (!profile) { if (!profile) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลบุคคลนี้ในระบบ"); throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลบุคคลนี้ในระบบ");
} }
await new permission().PermissionOrgUserGet(request, "SYS_REGISTRY_EMP", profile.id); // await new permission().PermissionOrgUserGet(request, "SYS_REGISTRY_EMP", profile.id);//ไม่แน่ใจEMPปิดไว้ก่อน
const orgRevisionPublish = await this.orgRevisionRepo const orgRevisionPublish = await this.orgRevisionRepo
.createQueryBuilder("orgRevision") .createQueryBuilder("orgRevision")

View file

@ -1310,7 +1310,7 @@ export class ProfileEmployeeTempController extends Controller {
@Get("history/{id}") @Get("history/{id}")
async getProfileHistory(@Path() id: string, @Request() req: RequestWithUser) { async getProfileHistory(@Path() id: string, @Request() req: RequestWithUser) {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP"); // await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน
const profile = await this.profileHistoryRepo.find({ const profile = await this.profileHistoryRepo.find({
relations: { relations: {
posLevel: true, posLevel: true,