Merge branch 'develop' of github.com:Frappet/bma-ehr-organization into develop
This commit is contained in:
commit
1e1dbfd519
62 changed files with 263 additions and 179 deletions
|
|
@ -14,6 +14,7 @@ import { In } from "typeorm";
|
|||
import permission from "../interfaces/permission";
|
||||
import { ProfileEmployee } from "../entities/ProfileEmployee";
|
||||
import { EmployeePosMaster } from "../entities/EmployeePosMaster";
|
||||
import { OrgRevision } from "../entities/OrgRevision";
|
||||
const REDIS_HOST = process.env.REDIS_HOST;
|
||||
const REDIS_PORT = process.env.REDIS_PORT;
|
||||
|
||||
|
|
@ -28,10 +29,18 @@ export class PermissionController extends Controller {
|
|||
private authRoleRepo = AppDataSource.getRepository(AuthRole);
|
||||
private authRoleAttrRepo = AppDataSource.getRepository(AuthRoleAttr);
|
||||
private authSysRepo = AppDataSource.getRepository(AuthSys);
|
||||
private orgRevisionRepository = AppDataSource.getRepository(OrgRevision);
|
||||
private redis = require("redis");
|
||||
|
||||
@Get("")
|
||||
public async getPermission(@Request() request: { user: Record<string, any> }) {
|
||||
const orgRevision = await this.orgRevisionRepository.findOne({
|
||||
select: ["id"],
|
||||
where: {
|
||||
orgRevisionIsDraft: false,
|
||||
orgRevisionIsCurrent: true,
|
||||
},
|
||||
});
|
||||
const redisClient = await this.redis.createClient({
|
||||
host: REDIS_HOST,
|
||||
port: REDIS_PORT,
|
||||
|
|
@ -62,10 +71,11 @@ export class PermissionController extends Controller {
|
|||
select: ["authRoleId"],
|
||||
where: {
|
||||
current_holderId: profile.id,
|
||||
orgRevision: {
|
||||
orgRevisionIsDraft: false,
|
||||
orgRevisionIsCurrent: true,
|
||||
},
|
||||
// orgRevision: {
|
||||
// orgRevisionIsDraft: false,
|
||||
// orgRevisionIsCurrent: true,
|
||||
// },
|
||||
orgRevisionId: orgRevision?.id
|
||||
},
|
||||
});
|
||||
if (!posMaster) {
|
||||
|
|
@ -73,10 +83,11 @@ export class PermissionController extends Controller {
|
|||
select: ["authRoleId"],
|
||||
where: {
|
||||
current_holderId: profile.id,
|
||||
orgRevision: {
|
||||
orgRevisionIsDraft: false,
|
||||
orgRevisionIsCurrent: true,
|
||||
},
|
||||
// orgRevision: {
|
||||
// orgRevisionIsDraft: false,
|
||||
// orgRevisionIsCurrent: true,
|
||||
// },
|
||||
orgRevisionId: orgRevision?.id
|
||||
},
|
||||
});
|
||||
if (!posMaster) {
|
||||
|
|
@ -118,6 +129,13 @@ export class PermissionController extends Controller {
|
|||
|
||||
@Get("menu")
|
||||
public async listAuthSys(@Request() request: { user: Record<string, any> }) {
|
||||
const orgRevision = await this.orgRevisionRepository.findOne({
|
||||
select: ["id"],
|
||||
where: {
|
||||
orgRevisionIsDraft: false,
|
||||
orgRevisionIsCurrent: true,
|
||||
},
|
||||
});
|
||||
const redisClient = await this.redis.createClient({
|
||||
host: REDIS_HOST,
|
||||
port: REDIS_PORT,
|
||||
|
|
@ -148,10 +166,11 @@ export class PermissionController extends Controller {
|
|||
select: ["authRoleId"],
|
||||
where: {
|
||||
current_holderId: profile.id,
|
||||
orgRevision: {
|
||||
orgRevisionIsDraft: false,
|
||||
orgRevisionIsCurrent: true,
|
||||
},
|
||||
// orgRevision: {
|
||||
// orgRevisionIsDraft: false,
|
||||
// orgRevisionIsCurrent: true,
|
||||
// },
|
||||
orgRevisionId: orgRevision?.id
|
||||
},
|
||||
});
|
||||
if (!posMaster) {
|
||||
|
|
@ -159,10 +178,11 @@ export class PermissionController extends Controller {
|
|||
select: ["authRoleId"],
|
||||
where: {
|
||||
current_holderId: profile.id,
|
||||
orgRevision: {
|
||||
orgRevisionIsDraft: false,
|
||||
orgRevisionIsCurrent: true,
|
||||
},
|
||||
// orgRevision: {
|
||||
// orgRevisionIsDraft: false,
|
||||
// orgRevisionIsCurrent: true,
|
||||
// },
|
||||
orgRevisionId: orgRevision?.id
|
||||
},
|
||||
});
|
||||
if (!posMaster) {
|
||||
|
|
@ -281,6 +301,13 @@ export class PermissionController extends Controller {
|
|||
|
||||
@Get("org")
|
||||
public async listAuthSysOrg(@Request() request: RequestWithUser) {
|
||||
const orgRevision = await this.orgRevisionRepository.findOne({
|
||||
select: ["id"],
|
||||
where: {
|
||||
orgRevisionIsDraft: false,
|
||||
orgRevisionIsCurrent: true,
|
||||
},
|
||||
});
|
||||
const redisClient = await this.redis.createClient({
|
||||
host: REDIS_HOST,
|
||||
port: REDIS_PORT,
|
||||
|
|
@ -311,10 +338,11 @@ export class PermissionController extends Controller {
|
|||
const posMaster = await this.posMasterRepository.findOne({
|
||||
where: {
|
||||
current_holderId: profile.id,
|
||||
orgRevision: {
|
||||
orgRevisionIsDraft: false,
|
||||
orgRevisionIsCurrent: true,
|
||||
},
|
||||
// orgRevision: {
|
||||
// orgRevisionIsDraft: false,
|
||||
// orgRevisionIsCurrent: true,
|
||||
// },
|
||||
orgRevisionId: orgRevision?.id
|
||||
},
|
||||
});
|
||||
if (!posMaster) {
|
||||
|
|
@ -339,10 +367,11 @@ export class PermissionController extends Controller {
|
|||
const posMaster = await this.posMasterEmpRepository.findOne({
|
||||
where: {
|
||||
current_holderId: profile.id,
|
||||
orgRevision: {
|
||||
orgRevisionIsDraft: false,
|
||||
orgRevisionIsCurrent: true,
|
||||
},
|
||||
// orgRevision: {
|
||||
// orgRevisionIsDraft: false,
|
||||
// orgRevisionIsCurrent: true,
|
||||
// },
|
||||
orgRevisionId: orgRevision?.id
|
||||
},
|
||||
});
|
||||
if (!posMaster) {
|
||||
|
|
@ -371,6 +400,13 @@ export class PermissionController extends Controller {
|
|||
|
||||
@Get("user/{id}")
|
||||
public async listOrgUser(@Request() request: RequestWithUser, @Path() id: string) {
|
||||
const orgRevision = await this.orgRevisionRepository.findOne({
|
||||
select: ["id"],
|
||||
where: {
|
||||
orgRevisionIsDraft: false,
|
||||
orgRevisionIsCurrent: true,
|
||||
},
|
||||
});
|
||||
const redisClient = await this.redis.createClient({
|
||||
host: REDIS_HOST,
|
||||
port: REDIS_PORT,
|
||||
|
|
@ -401,10 +437,11 @@ export class PermissionController extends Controller {
|
|||
const posMaster = await this.posMasterRepository.findOne({
|
||||
where: {
|
||||
current_holderId: profile.id,
|
||||
orgRevision: {
|
||||
orgRevisionIsDraft: false,
|
||||
orgRevisionIsCurrent: true,
|
||||
},
|
||||
// orgRevision: {
|
||||
// orgRevisionIsDraft: false,
|
||||
// orgRevisionIsCurrent: true,
|
||||
// },
|
||||
orgRevisionId: orgRevision?.id
|
||||
},
|
||||
});
|
||||
if (!posMaster) {
|
||||
|
|
@ -429,10 +466,11 @@ export class PermissionController extends Controller {
|
|||
const posMaster = await this.posMasterEmpRepository.findOne({
|
||||
where: {
|
||||
current_holderId: profile.id,
|
||||
orgRevision: {
|
||||
orgRevisionIsDraft: false,
|
||||
orgRevisionIsCurrent: true,
|
||||
},
|
||||
// orgRevision: {
|
||||
// orgRevisionIsDraft: false,
|
||||
// orgRevisionIsCurrent: true,
|
||||
// },
|
||||
orgRevisionId: orgRevision?.id
|
||||
},
|
||||
});
|
||||
if (!posMaster) {
|
||||
|
|
|
|||
|
|
@ -148,12 +148,12 @@ export class ProfileAbilityController extends Controller {
|
|||
if (!body.profileId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId");
|
||||
}
|
||||
|
||||
|
||||
const profile = await this.profileRepo.findOneBy({ id: body.profileId });
|
||||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id);//ตส
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id);
|
||||
|
||||
const data = new ProfileAbility();
|
||||
const meta = {
|
||||
|
|
@ -209,7 +209,11 @@ export class ProfileAbilityController extends Controller {
|
|||
public async deleteProfileAbility(@Path() abilityId: string, @Request() req: RequestWithUser) {
|
||||
const _record = await this.profileAbilityRepo.findOneBy({ id: abilityId });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserDelete(req,"SYS_REGISTRY_OFFICER",_record.profileId);
|
||||
await new permission().PermissionOrgUserDelete(
|
||||
req,
|
||||
"SYS_REGISTRY_OFFICER",
|
||||
_record.profileId,
|
||||
);
|
||||
}
|
||||
await this.profileAbilityHistoryRepo.delete({
|
||||
profileAbilityId: abilityId,
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ export class ProfileAbilityEmployeeController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
|
||||
const data = new ProfileAbility();
|
||||
const meta = {
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ export class ProfileAbilityEmployeeTempController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");
|
||||
|
||||
const data = new ProfileAbility();
|
||||
const meta = {
|
||||
|
|
|
|||
|
|
@ -69,7 +69,10 @@ export class ProfileAddressEmployeeTempController extends Controller {
|
|||
*
|
||||
*/
|
||||
@Get("{profileEmployeeId}")
|
||||
public async detailProfileAddress(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
public async detailProfileAddress(
|
||||
@Path() profileEmployeeId: string,
|
||||
@Request() req: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const getProfileAddress = await this.profileEmployeeRepo.findOne({
|
||||
where: { id: profileEmployeeId },
|
||||
|
|
@ -100,7 +103,7 @@ export class ProfileAddressEmployeeTempController extends Controller {
|
|||
*/
|
||||
@Get("history/user")
|
||||
public async getProfileAddressHistoryUser(@Request() request: RequestWithUser) {
|
||||
// await new permission().PermissionGet(request, "SYS_REGISTRY_TEMP");//ตสTEMP
|
||||
// await new permission().PermissionGet(request, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
|
||||
const profile = await this.profileEmployeeRepo.findOneBy({ keycloak: request.user.sub });
|
||||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
|
|
@ -142,7 +145,10 @@ export class ProfileAddressEmployeeTempController extends Controller {
|
|||
*
|
||||
*/
|
||||
@Get("history/{profileId}")
|
||||
public async getProfileAddressHistory(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
public async getProfileAddressHistory(
|
||||
@Path() profileId: string,
|
||||
@Request() req: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.profileAddressHistoryRepo.find({
|
||||
where: { profileEmployeeId: profileId },
|
||||
|
|
|
|||
|
|
@ -163,12 +163,12 @@ export class ProfileAssessmentsController extends Controller {
|
|||
if (!body.profileId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId");
|
||||
}
|
||||
|
||||
|
||||
const profile = await this.profileRepo.findOneBy({ id: body.profileId });
|
||||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id);//ตส
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id);
|
||||
|
||||
const data = new ProfileAssessment();
|
||||
const meta = {
|
||||
|
|
@ -194,11 +194,10 @@ export class ProfileAssessmentsController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Path() assessmentId: string,
|
||||
) {
|
||||
|
||||
const record = await this.profileAssessmentsRepository.findOneBy({ id: assessmentId });
|
||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", record.profileId);
|
||||
|
||||
|
||||
const history = new ProfileAssessmentHistory();
|
||||
|
||||
Object.assign(record, body);
|
||||
|
|
@ -227,7 +226,11 @@ export class ProfileAssessmentsController extends Controller {
|
|||
) {
|
||||
const _record = await this.profileAssessmentsRepository.findOneBy({ id: assessmentId });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserDelete(req, "SYS_REGISTRY_OFFICER", _record.profileId);
|
||||
await new permission().PermissionOrgUserDelete(
|
||||
req,
|
||||
"SYS_REGISTRY_OFFICER",
|
||||
_record.profileId,
|
||||
);
|
||||
}
|
||||
await this.profileAssessmentsHistoryRepository.delete({
|
||||
profileAssessmentId: assessmentId,
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ export class ProfileAssessmentsEmployeeController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
|
||||
const data = new ProfileAssessment();
|
||||
const meta = {
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ export class ProfileAssessmentsEmployeeTempController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Body() body: CreateProfileEmployeeAssessment,
|
||||
) {
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");
|
||||
if (!body.profileEmployeeId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileEmployeeId");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ export class ProfileAvatarController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id);
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id);
|
||||
|
||||
const data = new ProfileAvatar();
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ export class ProfileAvatarEmployeeController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
|
||||
const data = new ProfileAvatar();
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,10 @@ export class ProfileAvatarEmployeeTempController extends Controller {
|
|||
private avatarRepository = AppDataSource.getRepository(ProfileAvatar);
|
||||
|
||||
@Get("{profileEmployeeId}")
|
||||
public async getAvatarEmployee(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
public async getAvatarEmployee(
|
||||
@Path() profileEmployeeId: string,
|
||||
@Request() req: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
|
||||
const lists = await this.avatarRepository.find({
|
||||
where: { profileEmployeeId },
|
||||
|
|
@ -24,8 +27,12 @@ export class ProfileAvatarEmployeeTempController extends Controller {
|
|||
}
|
||||
|
||||
@Get("select/{profileEmployeeId}/{id}")
|
||||
public async selectAvatarEmployee(@Path() profileEmployeeId: string, @Path() id: string, @Request() req: RequestWithUser) {
|
||||
// await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ตสTEMP
|
||||
public async selectAvatarEmployee(
|
||||
@Path() profileEmployeeId: string,
|
||||
@Path() id: string,
|
||||
@Request() req: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); //ไม่แน่ใจTEMP
|
||||
const result = await this.avatarRepository.findOneBy({ id: id });
|
||||
if (!result) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
|
@ -56,7 +63,7 @@ export class ProfileAvatarEmployeeTempController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Body() body: CreateProfileEmployeeAvatar,
|
||||
) {
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");
|
||||
const profile = await this.profileRepository.findOne({
|
||||
where: { id: body.profileEmployeeId },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ export class ProfileCertificateController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id);
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id);
|
||||
|
||||
const data = new ProfileCertificate();
|
||||
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ export class ProfileCertificateEmployeeController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
|
||||
const data = new ProfileCertificate();
|
||||
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ export class ProfileCertificateEmployeeTempController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Body() body: CreateProfileEmployeeCertificate,
|
||||
) {
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");
|
||||
if (!body.profileEmployeeId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileEmployeeId");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ export class ProfileChangeNameController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id);
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id);
|
||||
|
||||
const data = new ProfileChangeName();
|
||||
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ export class ProfileChangeNameEmployeeController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
|
||||
const data = new ProfileChangeName();
|
||||
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ export class ProfileChangeNameEmployeeTempController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Body() body: CreateProfileChangeNameEmployee,
|
||||
) {
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");
|
||||
if (!body.profileEmployeeId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileEmployeeId");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ export class ProfileChildrenController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id);
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id);
|
||||
|
||||
const data = new ProfileChildren();
|
||||
const meta = {
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ export class ProfileChildrenEmployeeController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
|
||||
const data = new ProfileChildren();
|
||||
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ export class ProfileChildrenEmployeeTempController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Body() body: CreateProfileChildrenEmployee,
|
||||
) {
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");
|
||||
const profile = await this.profileRepository.findOneBy({ id: body.profileEmployeeId });
|
||||
|
||||
if (!profile) {
|
||||
|
|
|
|||
|
|
@ -2285,7 +2285,7 @@ export class ProfileController extends Controller {
|
|||
) {
|
||||
const _record = await this.profileRepo.findOneBy({ id: id });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserUpdate(request, "SYS_REGISTRY_OFFICER", id);//ตส
|
||||
await new permission().PermissionOrgUserUpdate(request, "SYS_REGISTRY_OFFICER", _record.id); //ไม่แน่ใจOFF
|
||||
}
|
||||
const exists =
|
||||
!!body.citizenId &&
|
||||
|
|
@ -3159,10 +3159,7 @@ export class ProfileController extends Controller {
|
|||
*
|
||||
*/
|
||||
@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);
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { id: id },
|
||||
|
|
@ -3376,10 +3373,7 @@ export class ProfileController extends Controller {
|
|||
*
|
||||
*/
|
||||
@Get("keycloakid/position/{id}")
|
||||
async getProfileByKeycloakid(
|
||||
@Request() request: RequestWithUser,
|
||||
@Path() id: string,
|
||||
) {
|
||||
async getProfileByKeycloakid(@Request() request: RequestWithUser, @Path() id: string) {
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { keycloak: id },
|
||||
select: ["id"],
|
||||
|
|
@ -3399,10 +3393,7 @@ export class ProfileController extends Controller {
|
|||
* @param id หมายเลขประจำตัวประชาชน (citizenId)
|
||||
*/
|
||||
@Get("citizenid/position/{id}")
|
||||
async getProfileByCitizenId(
|
||||
@Request() request: RequestWithUser,
|
||||
@Path() id: string,
|
||||
) {
|
||||
async getProfileByCitizenId(@Request() request: RequestWithUser, @Path() id: string) {
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { citizenId: id },
|
||||
relations: ["posLevel", "posType", "current_holders", "current_holders.orgRoot"],
|
||||
|
|
@ -3410,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);
|
||||
|
||||
const orgRevisionPublish = await this.orgRevisionRepo
|
||||
.createQueryBuilder("orgRevision")
|
||||
|
|
@ -3524,10 +3515,7 @@ export class ProfileController extends Controller {
|
|||
*
|
||||
*/
|
||||
@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);
|
||||
const profile = await this.profileEmpRepo.findOne({
|
||||
where: { id: id },
|
||||
|
|
@ -4848,8 +4836,9 @@ export class ProfileController extends Controller {
|
|||
* @summary ข้อมูลบุลคลที่มีอายุเกษียณราชการตามปี
|
||||
*
|
||||
*/
|
||||
@Get("profileid/retire/{year}") //ตส
|
||||
async getProfileByRetireYear(@Path() year: number) {
|
||||
@Get("profileid/retire/{year}")
|
||||
async getProfileByRetireYear(@Path() year: number, @Request() req: RequestWithUser) {
|
||||
// await new permission().PermissionOrgUserList(req, "SYS_REGISTRY_OFFICER", id);//ไม่แน่ใจOFF
|
||||
const profiles = await this.profileRepo
|
||||
.createQueryBuilder("profile")
|
||||
.leftJoinAndSelect("profile.posLevel", "posLevel")
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ export class ProfileDisciplineController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id);
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id);
|
||||
|
||||
const data = new ProfileDiscipline();
|
||||
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ export class ProfileDisciplineEmployeeController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
|
||||
const data = new ProfileDiscipline();
|
||||
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ export class ProfileDisciplineEmployeeTempController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Body() body: CreateProfileEmployeeDiscipline,
|
||||
) {
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");
|
||||
if (!body.profileEmployeeId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,12 +136,12 @@ export class ProfileDutyController extends Controller {
|
|||
if (!body.profileId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId");
|
||||
}
|
||||
|
||||
|
||||
const profile = await this.profileRepository.findOneBy({ id: body.profileId });
|
||||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id);//ตส
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id); //ไม่แน่ใจOFF
|
||||
|
||||
const data = new ProfileDuty();
|
||||
|
||||
|
|
@ -195,7 +195,11 @@ export class ProfileDutyController extends Controller {
|
|||
public async deleteDuty(@Path() dutyId: string, @Request() req: RequestWithUser) {
|
||||
const _record = await this.dutyRepository.findOneBy({ id: dutyId });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserDelete(req, "SYS_REGISTRY_OFFICER", _record.profileId);
|
||||
await new permission().PermissionOrgUserDelete(
|
||||
req,
|
||||
"SYS_REGISTRY_OFFICER",
|
||||
_record.profileId,
|
||||
);
|
||||
}
|
||||
await this.dutyHistoryRepository.delete({
|
||||
profileDutyId: dutyId,
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ export class ProfileDutyEmployeeController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
|
||||
const data = new ProfileDuty();
|
||||
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ export class ProfileDutyEmployeeTempController extends Controller {
|
|||
|
||||
@Post()
|
||||
public async newDuty(@Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeDuty) {
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");
|
||||
if (!body.profileEmployeeId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ export class ProfileEducationsController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id);
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id);
|
||||
|
||||
const data = new ProfileEducation();
|
||||
const meta = {
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ export class ProfileEducationsEmployeeController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
|
||||
const data = new ProfileEducation();
|
||||
const meta = {
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ export class ProfileEducationsEmployeeTempController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Body() body: CreateProfileEducationEmployee,
|
||||
) {
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");
|
||||
if (!body.profileEmployeeId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileEmployeeId");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
relations: ["currentSubDistrict", "currentDistrict", "currentProvince"],
|
||||
where: { id: id },
|
||||
});
|
||||
if(profiles){
|
||||
if (profiles) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profiles.id);
|
||||
}
|
||||
const profileOc = await this.profileRepo.findOne({
|
||||
|
|
@ -580,7 +580,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
*
|
||||
*/
|
||||
@Post()
|
||||
async createProfile(@Body() body: CreateProfileEmployee, @Request() request: RequestWithUser) { //ตส
|
||||
async createProfile(@Body() body: CreateProfileEmployee, @Request() request: RequestWithUser) { //ไม่แน่ใจEMP
|
||||
if (await this.profileRepo.findOneBy({ citizenId: body.citizenId })) {
|
||||
throw new HttpError(
|
||||
HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
|
|
@ -633,7 +633,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
@Path() id: string,
|
||||
@Body() body: UpdateProfileEmployee,
|
||||
) {
|
||||
await new permission().PermissionOrgUserUpdate(request, "SYS_REGISTRY_EMP", id)
|
||||
await new permission().PermissionOrgUserUpdate(request, "SYS_REGISTRY_EMP", id);
|
||||
const exists =
|
||||
!!body.citizenId &&
|
||||
(await this.profileRepo.findOne({
|
||||
|
|
@ -1058,7 +1058,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
*/
|
||||
@Get("{id}")
|
||||
async detailProfile(@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.profileRepo.findOne({
|
||||
relations: {
|
||||
posLevel: true,
|
||||
|
|
@ -2077,7 +2077,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);
|
||||
if (body.posLevelId === "") body.posLevelId = null;
|
||||
if (body.posTypeId === "") body.posTypeId = null;
|
||||
|
||||
|
|
@ -2211,7 +2211,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
@Body()
|
||||
requestBody: { citizenId: string },
|
||||
) {
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", id)
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", id);
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { id: Not(id), citizenId: requestBody.citizenId },
|
||||
});
|
||||
|
|
@ -2657,8 +2657,9 @@ export class ProfileEmployeeController extends Controller {
|
|||
* @summary ข้อมูลบุลคลที่มีอายุเกษียณราชการตามปี
|
||||
*
|
||||
*/
|
||||
@Get("profileid/retire/{year}") //ตส
|
||||
async getProfileByRetireYear(@Path() year: number) {
|
||||
@Get("profileid/retire/{year}")
|
||||
async getProfileByRetireYear(@Path() year: number, @Request() req: RequestWithUser) {
|
||||
// await new permission().PermissionOrgUserList(req, "SYS_REGISTRY_EMP", id);//ไม่แน่ใจEMP
|
||||
const profiles = await this.profileRepo
|
||||
.createQueryBuilder("profileEmployee")
|
||||
.leftJoinAndSelect("profileEmployee.posLevel", "posLevel")
|
||||
|
|
@ -2861,7 +2862,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
where: { id: id },
|
||||
});
|
||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
await new permission().PermissionOrgUserCreate(request, "SYS_REGISTRY_EMP", profile.id)
|
||||
await new permission().PermissionOrgUserUpdate(request, "SYS_REGISTRY_EMP", profile.id);
|
||||
|
||||
profile.isLeave = requestBody.isLeave;
|
||||
profile.leaveReason = requestBody.leaveReason;
|
||||
|
|
@ -2892,8 +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);
|
||||
const profileEmp = await this.profileRepo.findOneBy({ id: profileEmployeeId });
|
||||
if (!profileEmp) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์นี้");
|
||||
|
||||
|
|
@ -2922,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);
|
||||
const profileInformation = await this.profileRepo.findOne({
|
||||
where: { id: profileEmployeeId },
|
||||
});
|
||||
|
|
@ -2953,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);
|
||||
const profileInformation = await this.profileRepo.find({
|
||||
relations: {
|
||||
information_histories: true,
|
||||
|
|
@ -2994,8 +2994,11 @@ export class ProfileEmployeeController extends Controller {
|
|||
* @param {string} profileEmployeeId profileEmployeeId ทะเบียนประวัติลูกจ้างชั่วคราว
|
||||
*/
|
||||
@Get("employment/{profileEmployeeId}")
|
||||
async ProfileEmployeeEmployment(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionOrgUserList(req, "SYS_REGISTRY_EMP", profileEmployeeId)
|
||||
async ProfileEmployeeEmployment(
|
||||
@Path() profileEmployeeId: string,
|
||||
@Request() req: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionOrgUserList(req, "SYS_REGISTRY_EMP", profileEmployeeId);
|
||||
const employment = await this.employmentRepository.find({
|
||||
where: { profileEmployeeId: profileEmployeeId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -3021,7 +3024,11 @@ export class ProfileEmployeeController extends Controller {
|
|||
where: { id: id },
|
||||
});
|
||||
if (employment) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", employment.profileEmployeeId)
|
||||
await new permission().PermissionOrgUserGet(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
employment.profileEmployeeId,
|
||||
);
|
||||
}
|
||||
return new HttpSuccess(employment);
|
||||
}
|
||||
|
|
@ -3039,7 +3046,11 @@ export class ProfileEmployeeController extends Controller {
|
|||
where: { id: id },
|
||||
});
|
||||
if (employment) {
|
||||
await new permission().PermissionOrgUserList(req, "SYS_REGISTRY_EMP", employment.profileEmployeeId)
|
||||
await new permission().PermissionOrgUserList(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
employment.profileEmployeeId,
|
||||
);
|
||||
}
|
||||
const employmentHistory = await this.employmentHistoryRepository.find({
|
||||
where: { profileEmployeeEmploymentId: id },
|
||||
|
|
@ -3065,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);
|
||||
|
||||
const employment = new ProfileEmployeeEmployment();
|
||||
// const history = new ProfileEmployeeEmploymentHistory();
|
||||
|
|
@ -3101,7 +3112,11 @@ export class ProfileEmployeeController extends Controller {
|
|||
where: { id: id },
|
||||
});
|
||||
if (employment) {
|
||||
await new permission().PermissionOrgUserDelete(request, "SYS_REGISTRY_EMP", employment.profileEmployeeId)
|
||||
await new permission().PermissionOrgUserDelete(
|
||||
request,
|
||||
"SYS_REGISTRY_EMP",
|
||||
employment.profileEmployeeId,
|
||||
);
|
||||
}
|
||||
await this.employmentHistoryRepository.delete({
|
||||
profileEmployeeEmploymentId: id,
|
||||
|
|
@ -3127,10 +3142,13 @@ export class ProfileEmployeeController extends Controller {
|
|||
@Path() id: string,
|
||||
@Body() body: UpdateEmploymentProfileEmployee,
|
||||
) {
|
||||
|
||||
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,
|
||||
);
|
||||
|
||||
const history = new ProfileEmployeeEmploymentHistory();
|
||||
Object.assign(history, { ...employment, id: undefined });
|
||||
|
|
@ -3412,10 +3430,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
*
|
||||
*/
|
||||
@Get("profileid/position/{id}")
|
||||
async getProfileByProfileid(
|
||||
@Request() request: RequestWithUser,
|
||||
@Path() id: string,
|
||||
) {
|
||||
async getProfileByProfileid(@Request() request: RequestWithUser, @Path() id: string) {
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { id: id },
|
||||
relations: ["posLevel", "posType", "current_holders", "current_holders.orgRoot"],
|
||||
|
|
|
|||
|
|
@ -1055,7 +1055,8 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
* @param {string} id Id ทะเบียนประวัติ
|
||||
*/
|
||||
@Get("{id}")
|
||||
async detailProfile(@Path() id: string) {//ตสTEMP
|
||||
async detailProfile(@Path() id: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); //ไม่แน่ใจTEMP
|
||||
const profile = await this.profileRepo.findOne({
|
||||
relations: {
|
||||
posLevel: true,
|
||||
|
|
@ -2069,11 +2070,12 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
* @param {string} id Id ทะเบียนประวัติลูกจ้างชั่วคราว
|
||||
*/
|
||||
@Put("position/{id}")
|
||||
async positionProfileEmployee(//ตสTEMP
|
||||
async positionProfileEmployee(
|
||||
@Request() request: RequestWithUser,
|
||||
@Path() id: string,
|
||||
@Body() body: UpdatePositionTempProfileEmployee,
|
||||
) {
|
||||
// await new permission().PermissionUpdate(request, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
|
||||
if (body.posLevelId === "") body.posLevelId = null;
|
||||
if (body.posTypeId === "") body.posTypeId = null;
|
||||
|
||||
|
|
@ -2201,7 +2203,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
* @param {string} id Id ทะเบียนประวัติ
|
||||
*/
|
||||
@Put("citizenId/{id}")
|
||||
async checkCitizenIdProfile(//ตสTEMP
|
||||
async checkCitizenIdProfile(
|
||||
@Path() id: string,
|
||||
@Body()
|
||||
requestBody: { citizenId: string },
|
||||
|
|
@ -2552,7 +2554,8 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*
|
||||
*/
|
||||
@Get("keycloak/position/{revisionId}")
|
||||
async getProfileByKeycloakByRevision(//ตสTEMP
|
||||
async getProfileByKeycloakByRevision(
|
||||
//ไม่แน่ใจTEMP
|
||||
@Path() revisionId: string,
|
||||
@Request() request: { user: Record<string, any> },
|
||||
) {
|
||||
|
|
@ -2652,8 +2655,9 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
* @summary ข้อมูลบุลคลที่มีอายุเกษียณราชการตามปี
|
||||
*
|
||||
*/
|
||||
@Get("profileid/retire/{year}")//ตสTEMP
|
||||
async getProfileByRetireYear(@Path() year: number) {
|
||||
@Get("profileid/retire/{year}")
|
||||
async getProfileByRetireYear(@Path() year: number, @Request() req: RequestWithUser) {
|
||||
// await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
|
||||
const profiles = await this.profileRepo
|
||||
.createQueryBuilder("profileEmployee")
|
||||
.leftJoinAndSelect("profileEmployee.posLevel", "posLevel")
|
||||
|
|
@ -2845,13 +2849,14 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*
|
||||
* @param {string} id Id ทะเบียนประวัติ
|
||||
*/
|
||||
@Post("leave/{id}")//ตสTEMP
|
||||
@Post("leave/{id}")
|
||||
async updateLeaveUser(
|
||||
@Path() id: string,
|
||||
@Body()
|
||||
requestBody: { isLeave: boolean; leaveReason: string; dateLeave: Date },
|
||||
@Request() request: { user: Record<string, any> },
|
||||
) {
|
||||
// await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
|
|
@ -2880,12 +2885,13 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*
|
||||
* @param {string} profileEmployeeId profileEmployeeId ทะเบียนประวัติลูกจ้างชั่วคราว
|
||||
*/
|
||||
@Put("information/{profileEmployeeId}")//ตสTEMP
|
||||
@Put("information/{profileEmployeeId}")
|
||||
async ProfileEmployeeInformation(
|
||||
@Request() request: RequestWithUser,
|
||||
@Path() profileEmployeeId: string,
|
||||
@Body() body: UpdateInformationProfileEmployee,
|
||||
) {
|
||||
// await new permission().PermissionUpdate(request, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
|
||||
const profileEmp = await this.profileRepo.findOneBy({ id: profileEmployeeId });
|
||||
if (!profileEmp) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์นี้");
|
||||
|
||||
|
|
@ -2912,8 +2918,9 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*
|
||||
* @param {string} profileEmployeeId profileEmployeeId ทะเบียนประวัติลูกจ้างชั่วคราว
|
||||
*/
|
||||
@Get("information/{profileEmployeeId}")//ตสTEMP
|
||||
async getInformationById(@Path() profileEmployeeId: string) {
|
||||
@Get("information/{profileEmployeeId}")
|
||||
async getInformationById(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
// await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
|
||||
const profileInformation = await this.profileRepo.findOne({
|
||||
where: { id: profileEmployeeId },
|
||||
});
|
||||
|
|
@ -2942,8 +2949,9 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*
|
||||
* @param {string} profileEmployeeId profileEmployeeId ทะเบียนประวัติลูกจ้างชั่วคราว
|
||||
*/
|
||||
@Get("information/history/{profileEmployeeId}")//ตสTEMP
|
||||
async getInformationHistory(@Path() profileEmployeeId: string) {
|
||||
@Get("information/history/{profileEmployeeId}")
|
||||
async getInformationHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
// await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
|
||||
const profileInformation = await this.profileRepo.find({
|
||||
relations: {
|
||||
information_histories: true,
|
||||
|
|
@ -2983,8 +2991,12 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*
|
||||
* @param {string} profileEmployeeId profileEmployeeId ทะเบียนประวัติลูกจ้างชั่วคราว
|
||||
*/
|
||||
@Get("employment/{profileEmployeeId}")//ตสTEMP
|
||||
async ProfileEmployeeEmployment(@Path() profileEmployeeId: string) {
|
||||
@Get("employment/{profileEmployeeId}")
|
||||
async ProfileEmployeeEmployment(
|
||||
@Path() profileEmployeeId: string,
|
||||
@Request() req: RequestWithUser,
|
||||
) {
|
||||
// await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
|
||||
const employment = await this.employmentRepository.find({
|
||||
where: { profileEmployeeId: profileEmployeeId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -3004,8 +3016,9 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*
|
||||
* @param {string} id Id ข้อมูลการจ้าง
|
||||
*/
|
||||
@Get("employment/id/{id}")//ตสTEMP
|
||||
async GetEmploymentById(@Path() id: string) {
|
||||
@Get("employment/id/{id}")
|
||||
async GetEmploymentById(@Path() id: string, @Request() req: RequestWithUser) {
|
||||
// await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
|
||||
const employment = await this.employmentRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
|
|
@ -3019,8 +3032,9 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*
|
||||
* @param {string} id Id ข้อมูลการจ้าง
|
||||
*/
|
||||
@Get("employment/history/{id}")//ตสTEMP
|
||||
async GetHistoryEmploymentById(@Path() id: string) {
|
||||
@Get("employment/history/{id}")
|
||||
async GetHistoryEmploymentById(@Path() id: string, @Request() req: RequestWithUser) {
|
||||
// await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
|
||||
const employmentHistory = await this.employmentHistoryRepository.find({
|
||||
where: { profileEmployeeEmploymentId: id },
|
||||
order: { lastUpdatedAt: "ASC" },
|
||||
|
|
@ -3035,12 +3049,13 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*
|
||||
* @param {string} profileEmployeeId profileEmployeeId ทะเบียนประวัติลูกจ้างชั่วคราว
|
||||
*/
|
||||
@Post("employment/{profileEmployeeId}")//ตสTEMP
|
||||
@Post("employment/{profileEmployeeId}")
|
||||
async CreateEmployment(
|
||||
@Path() profileEmployeeId: string,
|
||||
@Body() body: CreateEmploymentProfileEmployee,
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
// await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { id: profileEmployeeId },
|
||||
});
|
||||
|
|
@ -3074,8 +3089,9 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*
|
||||
* @param {string} id Id ข้อมูลการจ้าง
|
||||
*/
|
||||
@Delete("employment/{id}")//ตสTEMP
|
||||
@Delete("employment/{id}")
|
||||
async DeleteEmployment(@Path() id: string) {
|
||||
// await new permission().PermissionDelete(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
|
||||
await this.employmentHistoryRepository.delete({
|
||||
profileEmployeeEmploymentId: id,
|
||||
});
|
||||
|
|
@ -3094,12 +3110,13 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*
|
||||
* @param {string} id Id ข้อมูลการจ้าง
|
||||
*/
|
||||
@Put("employment/{id}")//ตสTEMP
|
||||
@Put("employment/{id}")
|
||||
async UpdateEmployment(
|
||||
@Request() request: RequestWithUser,
|
||||
@Path() id: string,
|
||||
@Body() body: UpdateEmploymentProfileEmployee,
|
||||
) {
|
||||
// await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
|
||||
const employment = await this.employmentRepository.findOneBy({ id });
|
||||
if (!employment) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
||||
|
|
@ -3127,8 +3144,9 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
* @summary ORG_038 - ออกคำสั่งลูกจ้าง (ADMIN) #
|
||||
*
|
||||
*/
|
||||
@Post("report")//ตสTEMP
|
||||
@Post("report")
|
||||
async sendReport(@Request() request: RequestWithUser, @Body() requestBody: { id: string[] }) {
|
||||
// await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
|
||||
const profiles = await this.profileRepo.find({ where: { id: In(requestBody.id) } });
|
||||
|
||||
const _profiles = await Promise.all(
|
||||
|
|
@ -3151,7 +3169,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
* @summary ORG_038 - ออกคำสั่งลูกจ้าง (ADMIN) #
|
||||
*
|
||||
*/
|
||||
@Post("report/resume")//ตสTEMP
|
||||
@Post("report/resume")
|
||||
async doneReport(
|
||||
@Body()
|
||||
body: {
|
||||
|
|
@ -3167,6 +3185,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
},
|
||||
@Request() request: { user: Record<string, any> },
|
||||
) {
|
||||
// await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
|
||||
await Promise.all(
|
||||
body.result.map(async (v) => {
|
||||
const profile = await this.profileRepo.findOne({
|
||||
|
|
@ -3216,7 +3235,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
* @summary ค้นหาข้อมูลทะเบียนประวัติที่ยังไม่เชื่อม keycloak
|
||||
*
|
||||
*/
|
||||
@Post("search-personal-no-keycloak")//ตสTEMP
|
||||
@Post("search-personal-no-keycloak")
|
||||
async getProfileBySearchKeywordNoKeyCloak(
|
||||
@Query("page") page: number = 1,
|
||||
@Query("pageSize") pageSize: number = 10,
|
||||
|
|
@ -3226,6 +3245,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
keyword?: string;
|
||||
},
|
||||
) {
|
||||
// await new permission().PermissionPost(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
|
||||
let findProfile: any;
|
||||
let total: any;
|
||||
const skip = (page - 1) * pageSize;
|
||||
|
|
@ -3382,11 +3402,9 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
* @summary ORG_065 - ข้อมูลทะเบียนประวัติตาม profileid (ADMIN) #70
|
||||
*
|
||||
*/
|
||||
@Get("profileid/position/{id}")//ตสTEMP
|
||||
async getProfileByProfileid(
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Path() id: string,
|
||||
) {
|
||||
@Get("profileid/position/{id}")
|
||||
async getProfileByProfileid(@Request() req: RequestWithUser, @Path() id: string) {
|
||||
// await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { id: id },
|
||||
relations: ["posLevel", "posType", "current_holders", "current_holders.orgRoot"],
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ export class ProfileFamilyCoupleController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id);//ตส
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id); //ไม่แน่ใจOFF
|
||||
familyCouple.coupleCitizenId = Extension.CheckCitizen(String(body.coupleCitizenId));
|
||||
familyCouple.createdUserId = req.user.sub;
|
||||
familyCouple.createdFullName = req.user.name;
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ export class ProfileFamilyCoupleEmployeeController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
|
||||
familyCouple.coupleCitizenId = Extension.CheckCitizen(String(body.coupleCitizenId));
|
||||
familyCouple.createdUserId = req.user.sub;
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ export class ProfileFamilyCoupleEmployeeTempController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Body() body: CreateProfileEmployeeFamilyCouple,
|
||||
) {
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");
|
||||
const familyCouple = Object.assign(new ProfileFamilyCouple(), body);
|
||||
if (!familyCouple) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ export class ProfileFamilyFatherController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id);//ตส
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id); //ไม่แน่ใจOFF
|
||||
familyFather.fatherCitizenId = Extension.CheckCitizen(String(body.fatherCitizenId));
|
||||
familyFather.createdUserId = req.user.sub;
|
||||
familyFather.createdFullName = req.user.name;
|
||||
|
|
@ -239,7 +239,7 @@ export class ProfileFamilyFatherController extends Controller {
|
|||
@Body() body: UpdateProfileFamilyFather,
|
||||
@Path() profileId: string,
|
||||
) {
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profileId);//ตส
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profileId); //ไม่แน่ใจOFF
|
||||
const familyFather = await this.ProfileFamilyFather.findOneBy({ profileId: profileId });
|
||||
if (!familyFather) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ export class ProfileFamilyFatherEmployeeController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
familyFather.fatherCitizenId = Extension.CheckCitizen(String(body.fatherCitizenId));
|
||||
familyFather.createdUserId = req.user.sub;
|
||||
familyFather.createdFullName = req.user.name;
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ export class ProfileFamilyFatherEmployeeTempController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Body() body: CreateProfileEmployeeFamilyFather,
|
||||
) {
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");
|
||||
const familyFather = Object.assign(new ProfileFamilyFather(), body);
|
||||
if (!familyFather) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ export class ProfileFamilyMotherController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER",profile.id);//ตส
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id); //ไม่แน่ใจOFF
|
||||
familyMother.motherCitizenId = Extension.CheckCitizen(String(body.motherCitizenId));
|
||||
familyMother.createdUserId = req.user.sub;
|
||||
familyMother.createdFullName = req.user.name;
|
||||
|
|
@ -238,7 +238,7 @@ export class ProfileFamilyMotherController extends Controller {
|
|||
@Body() body: UpdateProfileFamilyMother,
|
||||
@Path() profileId: string,
|
||||
) {
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER",profileId);//ตส
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profileId); //ไม่แน่ใจOFF
|
||||
const familyMother = await this.ProfileFamilyMother.findOneBy({ profileId: profileId });
|
||||
if (!familyMother) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ export class ProfileFamilyMotherEmployeeController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
familyMother.motherCitizenId = Extension.CheckCitizen(String(body.motherCitizenId));
|
||||
familyMother.createdUserId = req.user.sub;
|
||||
familyMother.createdFullName = req.user.name;
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ export class ProfileFamilyMotherEmployeeTempController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Body() body: CreateProfileEmployeeFamilyMother,
|
||||
) {
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");
|
||||
const familyMother = Object.assign(new ProfileFamilyMother(), body);
|
||||
if (!familyMother) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ export class ProfileHonorController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id);
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id);
|
||||
|
||||
const data = new ProfileHonor();
|
||||
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ export class ProfileHonorEmployeeController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
|
||||
const data = new ProfileHonor();
|
||||
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ export class ProfileHonorEmployeeTempController extends Controller {
|
|||
|
||||
@Post()
|
||||
public async newHonor(@Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeHonor) {
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");
|
||||
if (!body.profileEmployeeId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileEmployeeId");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ export class ProfileInsigniaController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id);
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id);
|
||||
|
||||
const insignia = await this.insigniaMetaRepo.findOne({
|
||||
where: { id: body.insigniaId },
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ export class ProfileInsigniaEmployeeController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_EMP", profile.id)
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id)
|
||||
|
||||
const insignia = await this.insigniaMetaRepo.findOne({
|
||||
where: { id: body.insigniaId },
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ export class ProfileInsigniaEmployeeTempController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Body() body: CreateProfileEmployeeInsignia,
|
||||
) {
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");
|
||||
if (!body.profileEmployeeId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileEmployeeId");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ export class ProfileLeaveController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id);
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id);
|
||||
|
||||
const leaveType = await this.leaveTypeRepository.findOne({
|
||||
where: { id: body.leaveTypeId },
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ export class ProfileLeaveEmployeeController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
|
||||
const leaveType = await this.leaveTypeRepository.findOne({
|
||||
where: { id: body.leaveTypeId },
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ export class ProfileLeaveEmployeeTempController extends Controller {
|
|||
|
||||
@Post()
|
||||
public async newLeave(@Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeLeave) {
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");
|
||||
if (!body.profileEmployeeId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ export class ProfileNopaidController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id);
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id);
|
||||
|
||||
const data = new ProfileNopaid();
|
||||
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ export class ProfileNopaidEmployeeController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
|
||||
const data = new ProfileNopaid();
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ export class ProfileNopaidEmployeeTempController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Body() body: CreateProfileEmployeeNopaid,
|
||||
) {
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");
|
||||
if (!body.profileEmployeeId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ export class ProfileOtherController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id);
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id);
|
||||
|
||||
const data = new ProfileOther();
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ export class ProfileOtherEmployeeController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
|
||||
const data = new ProfileOther();
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ export class ProfileOtherEmployeeTempController extends Controller {
|
|||
|
||||
@Post()
|
||||
public async newOther(@Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeOther) {
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");
|
||||
if (!body.profileEmployeeId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ export class ProfileSalaryController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id);
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id);
|
||||
|
||||
const dest_item = await this.salaryRepo.findOne({
|
||||
where: { profileId: body.profileId },
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ export class ProfileSalaryEmployeeController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
|
||||
const dest_item = await this.salaryRepo.findOne({
|
||||
where: { profileEmployeeId: body.profileEmployeeId },
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ export class ProfileSalaryEmployeeTempController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Body() body: CreateProfileSalaryEmployee,
|
||||
) {
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");
|
||||
if (!body.profileEmployeeId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileEmployeeId");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ export class ProfileTrainingController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_OFFICER", profile.id);
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id);
|
||||
|
||||
const data = new ProfileTraining();
|
||||
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ export class ProfileTrainingEmployeeController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
|
||||
|
||||
const data = new ProfileTraining();
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ export class ProfileTrainingEmployeeTempController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Body() body: CreateProfileEmployeeTraining,
|
||||
) {
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");
|
||||
if (!body.profileEmployeeId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileEmployeeId");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue