diff --git a/src/controllers/OrganizationController.ts b/src/controllers/OrganizationController.ts index ccae75c8..be2f06b3 100644 --- a/src/controllers/OrganizationController.ts +++ b/src/controllers/OrganizationController.ts @@ -625,23 +625,22 @@ export class OrganizationController extends Controller { ) { await new permission().PermissionList(request, "SYS_ORG"); } - if (_data.root != null) { - if (orgRevision.orgRevisionIsDraft == true && orgRevision.orgRevisionIsCurrent == false) { - const profile = await this.profileRepo.findOne({ - where: { keycloak: request.user.sub }, - relations: ["permissionProfiles"], - }); - if (!profile) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ใช้งานในทะเบียนประวัติ"); - } - _data = { - root: profile.permissionProfiles.map((x) => x.orgRootId), - child1: null, - child2: null, - child3: null, - child4: null, - }; + if (orgRevision.orgRevisionIsDraft == true && orgRevision.orgRevisionIsCurrent == false) { + const profile = await this.profileRepo.findOne({ + where: { keycloak: request.user.sub }, + relations: ["permissionProfiles"], + }); + if (!profile) { + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ใช้งานในทะเบียนประวัติ"); } + _data = { + root: profile.permissionProfiles.map((x) => x.orgRootId), + child1: null, + child2: null, + child3: null, + child4: null, + }; + console.log(_data); } const orgRootData = await AppDataSource.getRepository(OrgRoot)