@vcita/oauth-client-nestjs 1.22.0-2 → 1.22.0

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.
@@ -8,40 +8,24 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
- var __param = (this && this.__param) || function (paramIndex, decorator) {
12
- return function (target, key) { decorator(target, key, paramIndex); }
13
- };
14
11
  var WebhooksService_1;
15
12
  Object.defineProperty(exports, "__esModule", { value: true });
16
13
  exports.WebhooksService = void 0;
17
14
  const common_1 = require("@nestjs/common");
18
15
  const infra_nestjs_1 = require("@vcita/infra-nestjs");
19
- const typeorm_1 = require("@nestjs/typeorm");
20
- const typeorm_2 = require("typeorm");
21
- const oauth_data_entity_1 = require("../repositories/oauth-data.entity");
16
+ const oauth_service_1 = require("./oauth.service");
22
17
  let WebhooksService = WebhooksService_1 = class WebhooksService {
23
- constructor(repository) {
24
- this.repository = repository;
18
+ constructor(oauthService) {
19
+ this.oauthService = oauthService;
25
20
  this.logger = new infra_nestjs_1.InfraLoggerService(WebhooksService_1.name);
26
21
  }
27
22
  async revokeAccessTokensForBusiness(businessUid, eventTime) {
28
- this.logger.info(`Expiring tokens of business ${businessUid}`);
29
- const res = await this.repository
30
- .createQueryBuilder()
31
- .update()
32
- .set({ expired_at: new Date() })
33
- .where({
34
- entity_data: (0, typeorm_2.Like)(`%${businessUid}%`),
35
- })
36
- .andWhere({ expired_at: (0, typeorm_2.MoreThan)(new Date(eventTime)) })
37
- .execute();
38
- this.logger.info(`Expired tokens of business [${businessUid}] successfully. Affected rows: ${res.affected}`);
23
+ return await this.oauthService.revokeAccessTokensForBusiness(businessUid, eventTime);
39
24
  }
40
25
  };
41
26
  WebhooksService = WebhooksService_1 = __decorate([
42
27
  (0, common_1.Injectable)(),
43
- __param(0, (0, typeorm_1.InjectRepository)(oauth_data_entity_1.OauthData)),
44
- __metadata("design:paramtypes", [typeorm_2.Repository])
28
+ __metadata("design:paramtypes", [oauth_service_1.OauthService])
45
29
  ], WebhooksService);
46
30
  exports.WebhooksService = WebhooksService;
47
31
  //# sourceMappingURL=webhooks.service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"webhooks.service.js","sourceRoot":"","sources":["../../../src/oauth/services/webhooks.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,sDAAyD;AACzD,6CAAmD;AACnD,qCAAqD;AACrD,yEAA8D;AAG9D,IAAa,eAAe,uBAA5B,MAAa,eAAe;IAG1B,YAEU,UAAiC;QAAjC,eAAU,GAAV,UAAU,CAAuB;QAJ1B,WAAM,GAAG,IAAI,iCAAkB,CAAC,iBAAe,CAAC,IAAI,CAAC,CAAC;IAKpE,CAAC;IAEJ,KAAK,CAAC,6BAA6B,CAAC,WAAmB,EAAE,SAAwB;QAC/E,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,+BAA+B,WAAW,EAAE,CAAC,CAAC;QAE/D,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,UAAU;aAC9B,kBAAkB,EAAE;aACpB,MAAM,EAAE;aACR,GAAG,CAAC,EAAE,UAAU,EAAE,IAAI,IAAI,EAAE,EAAE,CAAC;aAC/B,KAAK,CAAC;YACL,WAAW,EAAE,IAAA,cAAI,EAAC,IAAI,WAAW,GAAG,CAAC;SACtC,CAAC;aACD,QAAQ,CAAC,EAAE,UAAU,EAAE,IAAA,kBAAQ,EAAC,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;aACvD,OAAO,EAAE,CAAC;QAEb,IAAI,CAAC,MAAM,CAAC,IAAI,CACd,+BAA+B,WAAW,kCAAkC,GAAG,CAAC,QAAQ,EAAE,CAC3F,CAAC;IACJ,CAAC;CACF,CAAA;AAzBY,eAAe;IAD3B,IAAA,mBAAU,GAAE;IAKR,W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