Merge branch 'develop' of github.com:Frappet/bma-ehr-organization into develop
This commit is contained in:
commit
70e1ab9efd
3 changed files with 42 additions and 43 deletions
|
|
@ -994,7 +994,7 @@ export class ProfileController extends Controller {
|
|||
*/
|
||||
@Get("commander/{profileId}")
|
||||
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({
|
||||
where: { id: profileId },
|
||||
});
|
||||
|
|
@ -2503,7 +2503,7 @@ export class ProfileController extends Controller {
|
|||
|
||||
@Get("history/{id}")
|
||||
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({
|
||||
relations: {
|
||||
posLevel: true,
|
||||
|
|
@ -3160,7 +3160,7 @@ export class ProfileController extends Controller {
|
|||
*/
|
||||
@Get("profileid/position/{id}")
|
||||
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({
|
||||
where: { id: id },
|
||||
relations: ["posLevel", "posType", "current_holders", "current_holders.orgRoot"],
|
||||
|
|
@ -3381,7 +3381,7 @@ export class ProfileController extends Controller {
|
|||
if (!profile) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
@ -3401,7 +3401,7 @@ export class ProfileController extends Controller {
|
|||
if (!profile) {
|
||||
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
|
||||
.createQueryBuilder("orgRevision")
|
||||
|
|
@ -3516,7 +3516,7 @@ export class ProfileController extends Controller {
|
|||
*/
|
||||
@Get("profileempid/position/{id}")
|
||||
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({
|
||||
where: { id: id },
|
||||
relations: ["posLevel", "posType", "current_holders", "current_holders.orgRoot"],
|
||||
|
|
|
|||
|
|
@ -1313,7 +1313,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
|
||||
@Get("history/{id}")
|
||||
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({
|
||||
relations: {
|
||||
posLevel: true,
|
||||
|
|
@ -2078,7 +2078,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
@Path() id: string,
|
||||
@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.posTypeId === "") body.posTypeId = null;
|
||||
|
||||
|
|
@ -2212,7 +2212,6 @@ export class ProfileEmployeeController extends Controller {
|
|||
@Body()
|
||||
requestBody: { citizenId: string },
|
||||
) {
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", id);
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { id: Not(id), citizenId: requestBody.citizenId },
|
||||
});
|
||||
|
|
@ -2863,7 +2862,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
where: { id: id },
|
||||
});
|
||||
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.leaveReason = requestBody.leaveReason;
|
||||
|
|
@ -2894,7 +2893,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
@Path() profileEmployeeId: string,
|
||||
@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 });
|
||||
if (!profileEmp) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์นี้");
|
||||
|
||||
|
|
@ -2923,7 +2922,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
*/
|
||||
@Get("information/{profileEmployeeId}")
|
||||
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({
|
||||
where: { id: profileEmployeeId },
|
||||
});
|
||||
|
|
@ -2954,7 +2953,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
*/
|
||||
@Get("information/history/{profileEmployeeId}")
|
||||
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({
|
||||
relations: {
|
||||
information_histories: true,
|
||||
|
|
@ -2999,7 +2998,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
@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 employment = await this.employmentRepository.find({
|
||||
where: { profileEmployeeId: profileEmployeeId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -3024,13 +3023,13 @@ export class ProfileEmployeeController extends Controller {
|
|||
const employment = await this.employmentRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
if (employment) {
|
||||
await new permission().PermissionOrgUserGet(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
employment.profileEmployeeId,
|
||||
);
|
||||
}
|
||||
// if (employment) {
|
||||
// await new permission().PermissionOrgUserGet(
|
||||
// req,
|
||||
// "SYS_REGISTRY_EMP",
|
||||
// employment.profileEmployeeId,
|
||||
// );
|
||||
// }//ไม่แน่ใจEMPปิดไว้ก่อน
|
||||
return new HttpSuccess(employment);
|
||||
}
|
||||
|
||||
|
|
@ -3046,13 +3045,13 @@ export class ProfileEmployeeController extends Controller {
|
|||
const employment = await this.employmentRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
if (employment) {
|
||||
await new permission().PermissionOrgUserList(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
employment.profileEmployeeId,
|
||||
);
|
||||
}
|
||||
// if (employment) {
|
||||
// await new permission().PermissionOrgUserList(
|
||||
// req,
|
||||
// "SYS_REGISTRY_EMP",
|
||||
// employment.profileEmployeeId,
|
||||
// );
|
||||
// }//ไม่แน่ใจEMPปิดไว้ก่อน
|
||||
const employmentHistory = await this.employmentHistoryRepository.find({
|
||||
where: { profileEmployeeEmploymentId: id },
|
||||
order: { lastUpdatedAt: "ASC" },
|
||||
|
|
@ -3077,7 +3076,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
where: { id: profileEmployeeId },
|
||||
});
|
||||
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 history = new ProfileEmployeeEmploymentHistory();
|
||||
|
|
@ -3112,13 +3111,13 @@ export class ProfileEmployeeController extends Controller {
|
|||
const employment = await this.employmentRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
if (employment) {
|
||||
await new permission().PermissionOrgUserDelete(
|
||||
request,
|
||||
"SYS_REGISTRY_EMP",
|
||||
employment.profileEmployeeId,
|
||||
);
|
||||
}
|
||||
// if (employment) {
|
||||
// await new permission().PermissionOrgUserDelete(
|
||||
// request,
|
||||
// "SYS_REGISTRY_EMP",
|
||||
// employment.profileEmployeeId,
|
||||
// );
|
||||
// }//ไม่แน่ใจEMPปิดไว้ก่อน
|
||||
await this.employmentHistoryRepository.delete({
|
||||
profileEmployeeEmploymentId: id,
|
||||
});
|
||||
|
|
@ -3145,11 +3144,11 @@ export class ProfileEmployeeController extends Controller {
|
|||
) {
|
||||
const employment = await this.employmentRepository.findOneBy({ id });
|
||||
if (!employment) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
await new permission().PermissionOrgUserUpdate(
|
||||
request,
|
||||
"SYS_REGISTRY_EMP",
|
||||
employment.profileEmployeeId,
|
||||
);
|
||||
// await new permission().PermissionOrgUserUpdate(
|
||||
// request,
|
||||
// "SYS_REGISTRY_EMP",
|
||||
// employment.profileEmployeeId,
|
||||
// );//ไม่แน่ใจEMPปิดไว้ก่อน
|
||||
|
||||
const history = new ProfileEmployeeEmploymentHistory();
|
||||
Object.assign(history, { ...employment, id: undefined });
|
||||
|
|
@ -3439,7 +3438,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
if (!profile) {
|
||||
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
|
||||
.createQueryBuilder("orgRevision")
|
||||
|
|
|
|||
|
|
@ -1310,7 +1310,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
|
||||
@Get("history/{id}")
|
||||
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({
|
||||
relations: {
|
||||
posLevel: true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue