@servicelabsco/slabs-access-manager 0.0.28 → 0.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -70,12 +70,12 @@ import { UiActionSubscriber } from './subscribers/ui.action.subscriber';
70
70
  import { UserRoleSubscriber } from './subscribers/user.role.subscriber';
71
71
  declare const es6Classes: {
72
72
  controllers: (typeof AccessMenuController | typeof DashboardController)[];
73
- dtos: (typeof BusinessUserRoleAttributesDto | typeof AccessBusinessParamDto | typeof StringSearchDto)[];
73
+ dtos: (typeof AccessBusinessParamDto | typeof BusinessUserRoleAttributesDto | typeof StringSearchDto)[];
74
74
  entities: (typeof AccessBusinessEntity | typeof BusinessUserEntity | typeof ProductEntity | typeof BusinessUserRoleEntity | typeof MenuEntity | typeof ChildMenuEntity | typeof DashboardComponentEntity | typeof GroupRoleEntity | typeof ListingPreferenceEntity | typeof MenuActionEntity | typeof MenuRoleEntity | typeof ModuleMenuEntity | typeof UiActionRoleEntity | typeof UserRoleEntity)[];
75
75
  jobs: (typeof BusinessUserJob | typeof BusinessUserRoleJob | typeof ChildMenuJob | typeof CustomReportJob | typeof DashboardComponentJob | typeof DashboardJob | typeof GroupRoleJob | typeof ListPreferenceJob | typeof ListingColumnJob | typeof ListingPageJob | typeof ListingPreferenceJob | typeof MenuActionJob | typeof MenuJob | typeof MenuRoleJob | typeof ModuleJob | typeof ModuleMenuJob | typeof ProductJob | typeof RoleGroupJob | typeof UiActionJob | typeof UiActionRoleJob | typeof UserRoleJob)[];
76
76
  libraries: (typeof ProcessApplicationMenu | typeof ProcessMenuDetails | typeof ProcessDashboardReport | typeof ProcessBusinessUserRoleUpdate | typeof ProcessGroupRoleUpdate)[];
77
77
  middlewares: (typeof BusinessMiddleware)[];
78
- services: (typeof BusinessUserRoleService | typeof Es6JobsService | typeof LoadEntityService)[];
78
+ services: (typeof BusinessUserRoleService | typeof LoadEntityService | typeof Es6JobsService)[];
79
79
  subscribers: (typeof BusinessUserRoleSubscriber | typeof BusinessUserSubscriber | typeof ChildMenuSubscriber | typeof CustomReportSubscriber | typeof DashboardComponentSubscriber | typeof DashboardSubscriber | typeof GroupRoleSubscriber | typeof ListPreferenceSubscriber | typeof ListingColumnSubscriber | typeof ListingPageSubscriber | typeof ListingPreferenceSubscriber | typeof MenuActionSubscriber | typeof MenuRoleSubscriber | typeof MenuSubscriber | typeof ModuleMenuSubscriber | typeof ModuleSubscriber | typeof ProductSubscriber | typeof RoleGroupSubscriber | typeof UiActionRoleSubscriber | typeof UiActionSubscriber | typeof UserRoleSubscriber)[];
80
80
  };
81
81
  export default es6Classes;
@@ -1,8 +1,9 @@
1
- import { CommonJob, DatabaseEventDto, QueueService } from '@servicelabsco/nestjs-utility-services';
1
+ import { CommonJob, DatabaseEventDto, QueueService, SqlService } from '@servicelabsco/nestjs-utility-services';
2
2
  import { GroupRoleEntity } from '../entities/group.role.entity';
3
3
  export declare class GroupRoleJob extends CommonJob {
4
4
  protected readonly queueService: QueueService;
5
- constructor(queueService: QueueService);
5
+ private readonly sqlService;
6
+ constructor(queueService: QueueService, sqlService: SqlService);
6
7
  handle(evt: DatabaseEventDto<GroupRoleEntity>): Promise<void>;
7
8
  private handleUserRole;
8
9
  }
@@ -14,20 +14,21 @@ const common_1 = require("@nestjs/common");
14
14
  const nestjs_utility_services_1 = require("@servicelabsco/nestjs-utility-services");
15
15
  const process_group_role_update_1 = require("../libraries/process.group.role.update");
16
16
  let GroupRoleJob = class GroupRoleJob extends nestjs_utility_services_1.CommonJob {
17
- constructor(queueService) {
17
+ constructor(queueService, sqlService) {
18
18
  super();
19
19
  this.queueService = queueService;
20
+ this.sqlService = sqlService;
20
21
  }
21
22
  async handle(evt) {
22
23
  await this.handleUserRole(evt);
23
24
  }
24
25
  async handleUserRole(evt) {
25
- return new process_group_role_update_1.ProcessGroupRoleUpdate().process(evt);
26
+ return new process_group_role_update_1.ProcessGroupRoleUpdate(this.sqlService).process(evt);
26
27
  }
27
28
  };
28
29
  GroupRoleJob = __decorate([
29
30
  (0, common_1.Injectable)(),
30
- __metadata("design:paramtypes", [nestjs_utility_services_1.QueueService])
31
+ __metadata("design:paramtypes", [nestjs_utility_services_1.QueueService, nestjs_utility_services_1.SqlService])
31
32
  ], GroupRoleJob);
32
33
  exports.GroupRoleJob = GroupRoleJob;
33
34
  //# sourceMappingURL=group.role.job.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"group.role.job.js","sourceRoot":"","sources":["../../../src/access/jobs/group.role.job.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,oFAAmG;AAEnG,sFAAgF;AAEzE,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,mCAAS;IACvC,YAA+B,YAA0B;QACrD,KAAK,EAAE,CAAC;QADmB,iBAAY,GAAZ,YAAY,CAAc;IAEzD,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,GAAsC;QAC/C,MAAM,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;IAEO,KAAK,CAAC,cAAc,CAAC,GAAsC;QAC/D,OAAO,IAAI,kDAAsB,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACrD,CAAC;CACJ,CAAA;AAZY,YAAY;IADxB,IAAA,mBAAU,GAAE;qCAEoC,sCAAY;GADhD,YAAY,CAYxB;AAZY,oCAAY"}
1
+ {"version":3,"file":"group.role.job.js","sourceRoot":"","sources":["../../../src/access/jobs/group.role.job.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,oFAA+G;AAE/G,sFAAgF;AAEzE,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,mCAAS;IACvC,YAA+B,YAA0B,EAAmB,UAAsB;QAC9F,KAAK,EAAE,CAAC;QADmB,iBAAY,GAAZ,YAAY,CAAc;QAAmB,eAAU,GAAV,UAAU,CAAY;IAElG,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,GAAsC;QAC/C,MAAM,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;IAEO,KAAK,CAAC,cAAc,CAAC,GAAsC;QAC/D,OAAO,IAAI,kDAAsB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACpE,CAAC;CACJ,CAAA;AAZY,YAAY;IADxB,IAAA,mBAAU,GAAE;qCAEoC,sCAAY,EAA+B,oCAAU;GADzF,YAAY,CAYxB;AAZY,oCAAY"}
@@ -1,9 +1,10 @@
1
- import { DatabaseEventDto } from '@servicelabsco/nestjs-utility-services';
2
- import { BusinessUserRoleEntity, GroupRoleEntity } from '../entities';
1
+ import { DatabaseEventDto, SqlService } from '@servicelabsco/nestjs-utility-services';
2
+ import { GroupRoleEntity } from '../entities';
3
3
  export declare class ProcessGroupRoleUpdate {
4
- protected records: BusinessUserRoleEntity[];
4
+ private readonly sqlService;
5
+ constructor(sqlService: SqlService);
5
6
  process(evt: DatabaseEventDto<GroupRoleEntity>): Promise<void>;
6
- private init;
7
+ private getRecords;
7
8
  private handleInsertion;
8
9
  private handleDeletion;
9
10
  }
@@ -4,34 +4,39 @@ exports.ProcessGroupRoleUpdate = void 0;
4
4
  const entities_1 = require("../entities");
5
5
  const SOURCEHASH = require("../../config/source.hash");
6
6
  class ProcessGroupRoleUpdate {
7
+ constructor(sqlService) {
8
+ this.sqlService = sqlService;
9
+ }
7
10
  async process(evt) {
8
- await this.init(evt);
9
11
  if (evt.entity.deleted_at)
10
12
  return this.handleDeletion(evt);
11
13
  return this.handleInsertion(evt);
12
14
  }
13
- async init(evt) {
14
- this.records = await entities_1.BusinessUserRoleEntity.find({ where: { role_group_id: evt.entity.group_id }, relations: ['business_user'] });
15
+ async getRecords(entity) {
16
+ const sql = `select b.* from bz_business_user_roles a, bz_business_users b where a.deleted_at is null and b.deleted_at is null and a.business_user_id = b.id and a.role_group_id = ${entity.group_id}`;
17
+ return this.sqlService.sql(sql);
15
18
  }
16
19
  async handleInsertion(evt) {
17
- for (const record of this.records) {
20
+ const records = await this.getRecords(evt.entity);
21
+ for (const record of records) {
18
22
  await entities_1.UserRoleEntity.firstOrCreate({
19
23
  source_type: SOURCEHASH.groupRole,
20
24
  source_id: evt.entity.id,
21
25
  role_id: evt.entity.role_id,
22
- user_id: record.business_user.user_id,
23
- business_id: record.business_user.business_id,
26
+ user_id: record.user_id,
27
+ business_id: record.business_id,
24
28
  });
25
29
  }
26
30
  }
27
31
  async handleDeletion(evt) {
28
- for (const record of this.records) {
32
+ const records = await this.getRecords(evt.entity);
33
+ for (const record of records) {
29
34
  await entities_1.UserRoleEntity.softDelete({
30
35
  source_type: SOURCEHASH.groupRole,
31
36
  source_id: evt.entity.id,
32
37
  role_id: evt.entity.role_id,
33
- user_id: record.business_user.user_id,
34
- business_id: record.business_user.business_id,
38
+ user_id: record.user_id,
39
+ business_id: record.business_id,
35
40
  });
36
41
  }
37
42
  }
@@ -1 +1 @@
1
- {"version":3,"file":"process.group.role.update.js","sourceRoot":"","sources":["../../../src/access/libraries/process.group.role.update.ts"],"names":[],"mappings":";;;AACA,0CAAsF;AACtF,uDAAwD;AAExD,MAAa,sBAAsB;IAG/B,KAAK,CAAC,OAAO,CAAC,GAAsC;QAChD,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAErB,IAAI,GAAG,CAAC,MAAM,CAAC,UAAU;YAAE,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;QAC3D,OAAO,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;IACrC,CAAC;IAEO,KAAK,CAAC,IAAI,CAAC,GAAsC;QACrD,IAAI,CAAC,OAAO,GAAG,MAAM,iCAAsB,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IACtI,CAAC;IAEO,KAAK,CAAC,eAAe,CAAC,GAAsC;QAChE,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE;YAC/B,MAAM,yBAAc,CAAC,aAAa,CAAC;gBAC/B,WAAW,EAAE,UAAU,CAAC,SAAS;gBACjC,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE;gBACxB,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,OAAO;gBAC3B,OAAO,EAAE,MAAM,CAAC,aAAa,CAAC,OAAO;gBACrC,WAAW,EAAE,MAAM,CAAC,aAAa,CAAC,WAAW;aAChD,CAAC,CAAC;SACN;IACL,CAAC;IAEO,KAAK,CAAC,cAAc,CAAC,GAAsC;QAC/D,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE;YAC/B,MAAM,yBAAc,CAAC,UAAU,CAAC;gBAC5B,WAAW,EAAE,UAAU,CAAC,SAAS;gBACjC,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE;gBACxB,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,OAAO;gBAC3B,OAAO,EAAE,MAAM,CAAC,aAAa,CAAC,OAAO;gBACrC,WAAW,EAAE,MAAM,CAAC,aAAa,CAAC,WAAW;aAChD,CAAC,CAAC;SACN;IACL,CAAC;CACJ;AArCD,wDAqCC"}
1
+ {"version":3,"file":"process.group.role.update.js","sourceRoot":"","sources":["../../../src/access/libraries/process.group.role.update.ts"],"names":[],"mappings":";;;AACA,0CAA8D;AAC9D,uDAAwD;AAExD,MAAa,sBAAsB;IAC/B,YAA6B,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAAG,CAAC;IAEvD,KAAK,CAAC,OAAO,CAAC,GAAsC;QAChD,IAAI,GAAG,CAAC,MAAM,CAAC,UAAU;YAAE,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;QAC3D,OAAO,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;IACrC,CAAC;IAEO,KAAK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AAE;;;;6CAGL;AAED;IAAC,IAAA,YAAG,EAAC,eAAe,CAAC;;;;0CAGpB;AAGK;IADL,IAAA,YAAG,EAAC,UAAU,CAAC;;;;yCAGf;AAGK;IADL,IAAA,YAAG,EAAC,aAAa,CAAC;;;;kDAGlB;AAGK;IADL,IAAA,YAAG,EAAC,WAAW,CAAC;IACM,WAAA,IAAA,cAAK,EAAC,IAAI,CAAC,CAAA;;;;oDAEjC;AAGK;IADL,IAAA,YAAG,EAAC,OAAO,CAAC;;;;6CAMZ;AAGK;IADL,IAAA,YAAG,EAAC,KAAK,CAAC;;;;wCACG;AArCL,aAAa;IADzB,IAAA,mBAAU,GAAE;qCAEgC,wBAAU,EAAiC,sCAAY;GADvF,aAAa,CAsCzB;AAtCY,sCAAa"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@servicelabsco/slabs-access-manager",
3
- "version": "0.0.28",
3
+ "version": "0.0.29",
4
4
  "description": "Support for application level menus and dashboards",
5
5
  "author": "Hemant Kumar Sah <hemantanshu@gmail.com>",
6
6
  "license": "MIT",