@servicelabsco/slabs-access-manager 0.1.107 → 0.1.108

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.
@@ -1,7 +1,9 @@
1
- import { CommonJob, DatabaseEventDto, QueueService } from '@servicelabsco/nestjs-utility-services';
1
+ import { CacheService, CommonJob, DatabaseEventDto, QueueService } from '@servicelabsco/nestjs-utility-services';
2
2
  import { SlackIntegrationEntity } from '../entities/slack.integration.entity';
3
3
  export declare class SlackIntegrationJob extends CommonJob {
4
4
  protected readonly queueService: QueueService;
5
- constructor(queueService: QueueService);
5
+ protected readonly cacheService: CacheService;
6
+ constructor(queueService: QueueService, cacheService: CacheService);
6
7
  handle(evt: DatabaseEventDto<SlackIntegrationEntity>): Promise<SlackIntegrationEntity>;
8
+ removeTokenFromCacheService(evt: DatabaseEventDto<SlackIntegrationEntity>): Promise<void>;
7
9
  }
@@ -13,17 +13,28 @@ exports.SlackIntegrationJob = void 0;
13
13
  const common_1 = require("@nestjs/common");
14
14
  const nestjs_utility_services_1 = require("@servicelabsco/nestjs-utility-services");
15
15
  let SlackIntegrationJob = class SlackIntegrationJob extends nestjs_utility_services_1.CommonJob {
16
- constructor(queueService) {
16
+ constructor(queueService, cacheService) {
17
17
  super('6c893149710d196ed9e3afa79f311750');
18
18
  this.queueService = queueService;
19
+ this.cacheService = cacheService;
19
20
  }
20
21
  async handle(evt) {
22
+ await this.removeTokenFromCacheService(evt);
21
23
  return evt.entity;
22
24
  }
25
+ async removeTokenFromCacheService(evt) {
26
+ if (this.isNewRecord(evt))
27
+ return;
28
+ if (!this.isColumnUpdated(evt, ['is_enabled', 'access_token']))
29
+ return;
30
+ const key = `slack.business.${evt.entity.business_id}.token`;
31
+ return this.cacheService.delete(key);
32
+ }
23
33
  };
24
34
  exports.SlackIntegrationJob = SlackIntegrationJob;
25
35
  exports.SlackIntegrationJob = SlackIntegrationJob = __decorate([
26
36
  (0, common_1.Injectable)(),
27
- __metadata("design:paramtypes", [nestjs_utility_services_1.QueueService])
37
+ __metadata("design:paramtypes", [nestjs_utility_services_1.QueueService,
38
+ nestjs_utility_services_1.CacheService])
28
39
  ], SlackIntegrationJob);
29
40
  //# sourceMappingURL=slack.integration.job.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"slack.integration.job.js","sourceRoot":"","sources":["../../../src/access/jobs/slack.integration.job.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,oFAAmG;AAI5F,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,mCAAS;IAC9C,YAA+B,YAA0B;QACrD,KAAK,CAAC,kCAAkC,CAAC,CAAC;QADf,iBAAY,GAAZ,YAAY,CAAc;IAEzD,CAAC;IACD,KAAK,CAAC,MAAM,CAAC,GAA6C;QACtD,OAAO,GAAG,CAAC,MAAM,CAAC;IACtB,CAAC;CACJ,CAAA;AAPY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,mBAAU,GAAE;qCAEoC,sCAAY;GADhD,mBAAmB,CAO/B"}
1
+ {"version":3,"file":"slack.integration.job.js","sourceRoot":"","sources":["../../../src/access/jobs/slack.integration.job.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,oFAAiH;AAI1G,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,mCAAS;IAC9C,YACuB,YAA0B,EAC1B,YAA0B;QAE7C,KAAK,CAAC,kCAAkC,CAAC,CAAC;QAHvB,iBAAY,GAAZ,YAAY,CAAc;QAC1B,iBAAY,GAAZ,YAAY,CAAc;IAGjD,CAAC;IACD,KAAK,CAAC,MAAM,CAAC,GAA6C;QACtD,MAAM,IAAI,CAAC,2BAA2B,CAAC,GAAG,CAAC,CAAC;QAE5C,OAAO,GAAG,CAAC,MAAM,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,2BAA2B,CAAC,GAA6C;QAC3E,IAAI,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC;YAAE,OAAO;QAClC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,EAAE,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;YAAE,OAAO;QAEvE,MAAM,GAAG,GAAG,kBAAkB,GAAG,CAAC,MAAM,CAAC,WAAW,QAAQ,CAAC;QAE7D,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACzC,CAAC;CACJ,CAAA;AArBY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,mBAAU,GAAE;qCAG4B,sCAAY;QACZ,sCAAY;GAHxC,mBAAmB,CAqB/B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@servicelabsco/slabs-access-manager",
3
- "version": "0.1.107",
3
+ "version": "0.1.108",
4
4
  "description": "Support for application level menus and dashboards",
5
5
  "author": "Hemant Kumar Sah <hemantanshu@gmail.com>",
6
6
  "license": "MIT",