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

This commit is contained in:
kittapath 2024-08-27 17:30:39 +07:00
commit aaca39e87b
2 changed files with 41 additions and 41 deletions

View file

@ -2893,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);//ไม่แน่ใจEMPปิดไว้ก่อน await new permission().PermissionOrgUserUpdate(request, "SYS_REGISTRY_EMP", profileEmployeeId);
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, "ไม่พบข้อมูลโปรไฟล์นี้");
@ -2922,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);//ไม่แน่ใจEMPปิดไว้ก่อน await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileEmployeeId);
const profileInformation = await this.profileRepo.findOne({ const profileInformation = await this.profileRepo.findOne({
where: { id: profileEmployeeId }, where: { id: profileEmployeeId },
}); });
@ -2953,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);//ไม่แน่ใจEMPปิดไว้ก่อน await new permission().PermissionOrgUserList(req, "SYS_REGISTRY_EMP", profileEmployeeId);
const profileInformation = await this.profileRepo.find({ const profileInformation = await this.profileRepo.find({
relations: { relations: {
information_histories: true, information_histories: true,
@ -2998,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);//ไม่แน่ใจEMPปิดไว้ก่อน await new permission().PermissionOrgUserList(req, "SYS_REGISTRY_EMP", profileEmployeeId);
const employment = await this.employmentRepository.find({ const employment = await this.employmentRepository.find({
where: { profileEmployeeId: profileEmployeeId }, where: { profileEmployeeId: profileEmployeeId },
order: { createdAt: "ASC" }, order: { createdAt: "ASC" },
@ -3023,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);
} }
@ -3045,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" },
@ -3076,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);//ไม่แน่ใจEMPปิดไว้ก่อน await new permission().PermissionOrgUserUpdate(request, "SYS_REGISTRY_EMP", profile.id);
const employment = new ProfileEmployeeEmployment(); const employment = new ProfileEmployeeEmployment();
// const history = new ProfileEmployeeEmploymentHistory(); // const history = new ProfileEmployeeEmploymentHistory();
@ -3111,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,
}); });
@ -3144,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 });

View file

@ -2891,7 +2891,7 @@ export class ProfileEmployeeTempController extends Controller {
@Path() profileEmployeeId: string, @Path() profileEmployeeId: string,
@Body() body: UpdateInformationProfileEmployee, @Body() body: UpdateInformationProfileEmployee,
) { ) {
// await new permission().PermissionUpdate(request, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน await new permission().PermissionUpdate(request, "SYS_REGISTRY_TEMP");
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, "ไม่พบข้อมูลโปรไฟล์นี้");
@ -2920,7 +2920,7 @@ export class ProfileEmployeeTempController 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().PermissionGet(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const profileInformation = await this.profileRepo.findOne({ const profileInformation = await this.profileRepo.findOne({
where: { id: profileEmployeeId }, where: { id: profileEmployeeId },
}); });
@ -2951,7 +2951,7 @@ export class ProfileEmployeeTempController 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().PermissionList(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
const profileInformation = await this.profileRepo.find({ const profileInformation = await this.profileRepo.find({
relations: { relations: {
information_histories: true, information_histories: true,
@ -2996,7 +2996,7 @@ export class ProfileEmployeeTempController extends Controller {
@Path() profileEmployeeId: string, @Path() profileEmployeeId: string,
@Request() req: RequestWithUser, @Request() req: RequestWithUser,
) { ) {
// await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
const employment = await this.employmentRepository.find({ const employment = await this.employmentRepository.find({
where: { profileEmployeeId: profileEmployeeId }, where: { profileEmployeeId: profileEmployeeId },
order: { createdAt: "ASC" }, order: { createdAt: "ASC" },
@ -3018,7 +3018,7 @@ export class ProfileEmployeeTempController extends Controller {
*/ */
@Get("employment/id/{id}") @Get("employment/id/{id}")
async GetEmploymentById(@Path() id: string, @Request() req: RequestWithUser) { async GetEmploymentById(@Path() id: string, @Request() req: RequestWithUser) {
// await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const employment = await this.employmentRepository.findOne({ const employment = await this.employmentRepository.findOne({
where: { id: id }, where: { id: id },
}); });
@ -3034,7 +3034,7 @@ export class ProfileEmployeeTempController extends Controller {
*/ */
@Get("employment/history/{id}") @Get("employment/history/{id}")
async GetHistoryEmploymentById(@Path() id: string, @Request() req: RequestWithUser) { async GetHistoryEmploymentById(@Path() id: string, @Request() req: RequestWithUser) {
// await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const employmentHistory = await this.employmentHistoryRepository.find({ const employmentHistory = await this.employmentHistoryRepository.find({
where: { profileEmployeeEmploymentId: id }, where: { profileEmployeeEmploymentId: id },
order: { lastUpdatedAt: "ASC" }, order: { lastUpdatedAt: "ASC" },
@ -3055,7 +3055,7 @@ export class ProfileEmployeeTempController extends Controller {
@Body() body: CreateEmploymentProfileEmployee, @Body() body: CreateEmploymentProfileEmployee,
@Request() request: RequestWithUser, @Request() request: RequestWithUser,
) { ) {
// await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน await new permission().PermissionUpdate(request, "SYS_REGISTRY_TEMP");
const profile = await this.profileRepo.findOne({ const profile = await this.profileRepo.findOne({
where: { id: profileEmployeeId }, where: { id: profileEmployeeId },
}); });
@ -3090,8 +3090,8 @@ export class ProfileEmployeeTempController extends Controller {
* @param {string} id Id * @param {string} id Id
*/ */
@Delete("employment/{id}") @Delete("employment/{id}")
async DeleteEmployment(@Path() id: string) { async DeleteEmployment(@Path() id: string, @Request() req: RequestWithUser) {
// await new permission().PermissionDelete(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน await new permission().PermissionDelete(req, "SYS_REGISTRY_TEMP");
await this.employmentHistoryRepository.delete({ await this.employmentHistoryRepository.delete({
profileEmployeeEmploymentId: id, profileEmployeeEmploymentId: id,
}); });
@ -3116,7 +3116,7 @@ export class ProfileEmployeeTempController extends Controller {
@Path() id: string, @Path() id: string,
@Body() body: UpdateEmploymentProfileEmployee, @Body() body: UpdateEmploymentProfileEmployee,
) { ) {
// await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน await new permission().PermissionUpdate(request, "SYS_REGISTRY_TEMP");
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, "ไม่พบข้อมูล");