check workflow

This commit is contained in:
kittapath 2024-10-22 08:20:45 +07:00
parent 4c2188a363
commit 32b0aa325d
74 changed files with 529 additions and 285 deletions

View file

@ -45,7 +45,9 @@ export class ProfileSalaryController extends Controller {
@Get("{profileId}")
public async getSalary(@Path() profileId: string, @Request() req: RequestWithUser) {
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_OFFICER");
if (_workflow == false)
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
const record = await this.salaryRepo.find({
where: { profileId: profileId },
order: { order: "ASC" },
@ -55,7 +57,8 @@ export class ProfileSalaryController extends Controller {
@Get("admin/{profileId}")
public async getSalaryAdmin(@Path() profileId: string, @Request() req: RequestWithUser) {
await new permission().PermissionGet(req, "SYS_SALARY_OFFICER");
let _workflow = await new permission().Workflow(req, profileId, "SYS_SALARY_OFFICER");
if (_workflow == false) await new permission().PermissionGet(req, "SYS_SALARY_OFFICER");
const record = await this.salaryRepo.find({
where: { profileId: profileId },
order: { order: "ASC" },
@ -67,7 +70,9 @@ export class ProfileSalaryController extends Controller {
public async salaryAdminHistory(@Path() salaryId: string, @Request() req: RequestWithUser) {
const _record = await this.salaryRepo.findOneBy({ id: salaryId });
if (_record) {
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
let _workflow = await new permission().Workflow(req, salaryId, "SYS_REGISTRY_OFFICER");
if (_workflow == false)
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
}
const record = await this.salaryHistoryRepo.find({
where: {
@ -208,7 +213,7 @@ export class ProfileSalaryController extends Controller {
) {
const source_item = await this.salaryRepo.findOne({ where: { id: salaryId } });
// if (source_item) {
// await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", source_item.profileId);//ไม่แน่ใจOFFปิดไว้ก่อน
//await new permission().PermissionOrgUserGet(req,"SYS_REGISTRY_OFFICER",source_item.profileId,); //ไม่แน่ใจOFFปิดไว้ก่อน
// }
if (source_item == null) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
const sourceOrder = source_item.order;