@darraghor/nest-backend-libs 2.17.7 → 2.17.8
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.
- package/dist/organisation-subscriptions/entities/organisation-subscription.entity.d.ts +1 -1
- package/dist/organisation-subscriptions/entities/organisation-subscription.entity.js +3 -1
- package/dist/organisation-subscriptions/entities/organisation-subscription.entity.js.map +1 -1
- package/dist/organisation-subscriptions/models/saveSubscriptionDto.d.ts +7 -0
- package/dist/organisation-subscriptions/models/saveSubscriptionDto.js +51 -0
- package/dist/organisation-subscriptions/models/saveSubscriptionDto.js.map +1 -0
- package/dist/organisation-subscriptions/organisation-subscriptions.controller.d.ts +4 -0
- package/dist/organisation-subscriptions/organisation-subscriptions.controller.js +41 -1
- package/dist/organisation-subscriptions/organisation-subscriptions.controller.js.map +1 -1
- package/dist/organisation-subscriptions/organisation-subscriptions.service.d.ts +4 -1
- package/dist/organisation-subscriptions/organisation-subscriptions.service.js +35 -12
- package/dist/organisation-subscriptions/organisation-subscriptions.service.js.map +1 -1
- package/package.json +1 -1
|
@@ -11,6 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.OrganisationSubscriptionRecord = void 0;
|
|
13
13
|
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const class_transformer_1 = require("class-transformer");
|
|
14
15
|
const typeorm_1 = require("typeorm");
|
|
15
16
|
const organisation_entity_1 = require("../../organisation/entities/organisation.entity");
|
|
16
17
|
let OrganisationSubscriptionRecord = class OrganisationSubscriptionRecord {
|
|
@@ -57,7 +58,8 @@ __decorate([
|
|
|
57
58
|
__decorate([
|
|
58
59
|
(0, typeorm_1.Column)(),
|
|
59
60
|
(0, swagger_1.ApiProperty)(),
|
|
60
|
-
|
|
61
|
+
(0, class_transformer_1.Type)(() => Date),
|
|
62
|
+
__metadata("design:type", Date)
|
|
61
63
|
], OrganisationSubscriptionRecord.prototype, "validUntil", void 0);
|
|
62
64
|
__decorate([
|
|
63
65
|
(0, typeorm_1.ManyToOne)(() => organisation_entity_1.Organisation, (org) => org.subscriptionRecords, {}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organisation-subscription.entity.js","sourceRoot":"","sources":["../../../src/organisation-subscriptions/entities/organisation-subscription.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA4C;
|
|
1
|
+
{"version":3,"file":"organisation-subscription.entity.js","sourceRoot":"","sources":["../../../src/organisation-subscriptions/entities/organisation-subscription.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA4C;AAC5C,yDAAuC;AAEvC,qCASiB;AACjB,yFAA6E;AAGtE,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;IAGvC,EAAE,CAAU;IASL,IAAI,CAAU;IAIrB,oBAAoB,CAAU;IAI9B,gBAAgB,CAAU;IAI1B,aAAa,CAAU;IAKvB,UAAU,CAAQ;IAGlB,YAAY,CAAgB;IAIrB,cAAc,CAAU;IAI/B,WAAW,CAAQ;CACtB,CAAA;AAxCG;IAAC,IAAA,gCAAsB,GAAE;IACxB,IAAA,qBAAW,GAAE;;0DACF;AAEZ;IAAC,IAAA,gBAAM,EAAC,MAAM,EAAE;QACZ,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,GAAG,EAAE,CAAC,oBAAoB;KACtC,CAAC;IACD,IAAA,mBAAS,EAAC,MAAM,CAAC;IACjB,IAAA,qBAAW,GAAE;IACb,IAAA,eAAK,GAAE;;4DACa;AAErB;IAAC,IAAA,gBAAM,GAAE;IACR,IAAA,qBAAW,GAAE;;4EACgB;AAE9B;IAAC,IAAA,gBAAM,GAAE;IACR,IAAA,qBAAW,GAAE;;wEACY;AAE1B;IAAC,IAAA,gBAAM,GAAE;IACR,IAAA,qBAAW,GAAE;;qEACS;AAEvB;IAAC,IAAA,gBAAM,GAAE;IACR,IAAA,qBAAW,GAAE;IACb,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,IAAI,CAAC;8BACJ,IAAI;kEAAC;AAElB;IAAC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,kCAAY,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,mBAAmB,EAAE,EAAE,CAAC;8BACrD,kCAAY;oEAAC;AAE5B;IAAC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAU,EAAC,CAAC,GAAmC,EAAE,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC;;sEACvC;AAE/B;IAAC,IAAA,0BAAgB,GAAE;IAClB,IAAA,qBAAW,GAAE;8BACA,IAAI;mEAAC;AAxCV,8BAA8B;IAD1C,IAAA,gBAAM,GAAE;GACI,8BAA8B,CAyC1C;AAzCY,wEAA8B"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.SaveOrganisationSubscriptionRecordDto = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const class_transformer_1 = require("class-transformer");
|
|
15
|
+
const class_validator_1 = require("class-validator");
|
|
16
|
+
class SaveOrganisationSubscriptionRecordDto {
|
|
17
|
+
stripeSubscriptionId;
|
|
18
|
+
stripeCustomerId;
|
|
19
|
+
stripePriceId;
|
|
20
|
+
validUntil;
|
|
21
|
+
organisationUuid;
|
|
22
|
+
}
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, swagger_1.ApiProperty)(),
|
|
25
|
+
(0, class_validator_1.IsString)(),
|
|
26
|
+
__metadata("design:type", String)
|
|
27
|
+
], SaveOrganisationSubscriptionRecordDto.prototype, "stripeSubscriptionId", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, swagger_1.ApiProperty)(),
|
|
30
|
+
(0, class_validator_1.IsString)(),
|
|
31
|
+
__metadata("design:type", String)
|
|
32
|
+
], SaveOrganisationSubscriptionRecordDto.prototype, "stripeCustomerId", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, swagger_1.ApiProperty)(),
|
|
35
|
+
(0, class_validator_1.IsString)(),
|
|
36
|
+
__metadata("design:type", String)
|
|
37
|
+
], SaveOrganisationSubscriptionRecordDto.prototype, "stripePriceId", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, swagger_1.ApiProperty)(),
|
|
40
|
+
(0, class_transformer_1.Transform)(() => Date),
|
|
41
|
+
(0, class_transformer_1.Type)(() => Date),
|
|
42
|
+
(0, class_validator_1.IsDate)(),
|
|
43
|
+
__metadata("design:type", Date)
|
|
44
|
+
], SaveOrganisationSubscriptionRecordDto.prototype, "validUntil", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, swagger_1.ApiProperty)(),
|
|
47
|
+
(0, class_validator_1.IsString)(),
|
|
48
|
+
__metadata("design:type", String)
|
|
49
|
+
], SaveOrganisationSubscriptionRecordDto.prototype, "organisationUuid", void 0);
|
|
50
|
+
exports.SaveOrganisationSubscriptionRecordDto = SaveOrganisationSubscriptionRecordDto;
|
|
51
|
+
//# sourceMappingURL=saveSubscriptionDto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"saveSubscriptionDto.js","sourceRoot":"","sources":["../../../src/organisation-subscriptions/models/saveSubscriptionDto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA4C;AAC5C,yDAAkD;AAClD,qDAAiD;AAEjD,MAAa,qCAAqC;IAG9C,oBAAoB,CAAU;IAI9B,gBAAgB,CAAU;IAI1B,aAAa,CAAU;IAMvB,UAAU,CAAQ;IAIlB,gBAAgB,CAAU;CAC7B;AArBG;IAAC,IAAA,qBAAW,GAAE;IACb,IAAA,0BAAQ,GAAE;;mFACmB;AAE9B;IAAC,IAAA,qBAAW,GAAE;IACb,IAAA,0BAAQ,GAAE;;+EACe;AAE1B;IAAC,IAAA,qBAAW,GAAE;IACb,IAAA,0BAAQ,GAAE;;4EACY;AAEvB;IAAC,IAAA,qBAAW,GAAE;IACb,IAAA,6BAAS,EAAC,GAAG,EAAE,CAAC,IAAI,CAAC;IACrB,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,IAAI,CAAC;IAChB,IAAA,wBAAM,GAAE;8BACI,IAAI;yEAAC;AAElB;IAAC,IAAA,qBAAW,GAAE;IACb,IAAA,0BAAQ,GAAE;;+EACe;AArB9B,sFAsBC"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { RequestWithUser } from "../authz/RequestWithUser";
|
|
2
2
|
import { OrganisationSubscriptionRecord } from "./entities/organisation-subscription.entity";
|
|
3
3
|
import { OrganisationSubscriptionService } from "./organisation-subscriptions.service";
|
|
4
|
+
import { SaveOrganisationSubscriptionRecordDto } from "./models/saveSubscriptionDto";
|
|
4
5
|
export declare class OrganisationSubscriptionsController {
|
|
5
6
|
private readonly osrService;
|
|
6
7
|
constructor(osrService: OrganisationSubscriptionService);
|
|
7
8
|
findAll(orgUuid: string, request: RequestWithUser): Promise<OrganisationSubscriptionRecord[]>;
|
|
9
|
+
addSubscription(body: SaveOrganisationSubscriptionRecordDto): Promise<OrganisationSubscriptionRecord>;
|
|
10
|
+
updateSubscription(subUuid: string, body: SaveOrganisationSubscriptionRecordDto): Promise<OrganisationSubscriptionRecord>;
|
|
11
|
+
deleteSubscription(uuid: string): Promise<boolean>;
|
|
8
12
|
}
|
|
@@ -13,11 +13,14 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.OrganisationSubscriptionsController = void 0;
|
|
16
|
+
/* eslint-disable sonarjs/no-duplicate-string */
|
|
16
17
|
const common_1 = require("@nestjs/common");
|
|
17
18
|
const swagger_1 = require("@nestjs/swagger");
|
|
18
19
|
const passport_1 = require("@nestjs/passport");
|
|
19
20
|
const organisation_subscription_entity_1 = require("./entities/organisation-subscription.entity");
|
|
20
21
|
const organisation_subscriptions_service_1 = require("./organisation-subscriptions.service");
|
|
22
|
+
const authz_1 = require("../authz");
|
|
23
|
+
const saveSubscriptionDto_1 = require("./models/saveSubscriptionDto");
|
|
21
24
|
let OrganisationSubscriptionsController = class OrganisationSubscriptionsController {
|
|
22
25
|
osrService;
|
|
23
26
|
constructor(osrService) {
|
|
@@ -26,6 +29,15 @@ let OrganisationSubscriptionsController = class OrganisationSubscriptionsControl
|
|
|
26
29
|
async findAll(orgUuid, request) {
|
|
27
30
|
return this.osrService.findAllForOwnerOfOrg(orgUuid, request.user.id);
|
|
28
31
|
}
|
|
32
|
+
async addSubscription(body) {
|
|
33
|
+
return this.osrService.create(body);
|
|
34
|
+
}
|
|
35
|
+
async updateSubscription(subUuid, body) {
|
|
36
|
+
return this.osrService.update(subUuid, body);
|
|
37
|
+
}
|
|
38
|
+
async deleteSubscription(uuid) {
|
|
39
|
+
return this.osrService.delete(uuid);
|
|
40
|
+
}
|
|
29
41
|
};
|
|
30
42
|
__decorate([
|
|
31
43
|
(0, common_1.Get)(),
|
|
@@ -36,8 +48,36 @@ __decorate([
|
|
|
36
48
|
__metadata("design:paramtypes", [String, Object]),
|
|
37
49
|
__metadata("design:returntype", Promise)
|
|
38
50
|
], OrganisationSubscriptionsController.prototype, "findAll", null);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, authz_1.MandatoryUserClaims)("modify:all"),
|
|
53
|
+
(0, common_1.Post)(),
|
|
54
|
+
(0, swagger_1.ApiOkResponse)({ type: organisation_subscription_entity_1.OrganisationSubscriptionRecord }),
|
|
55
|
+
__param(0, (0, common_1.Body)()),
|
|
56
|
+
__metadata("design:type", Function),
|
|
57
|
+
__metadata("design:paramtypes", [saveSubscriptionDto_1.SaveOrganisationSubscriptionRecordDto]),
|
|
58
|
+
__metadata("design:returntype", Promise)
|
|
59
|
+
], OrganisationSubscriptionsController.prototype, "addSubscription", null);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, authz_1.MandatoryUserClaims)("modify:all"),
|
|
62
|
+
(0, common_1.Put)(":uuid"),
|
|
63
|
+
(0, swagger_1.ApiOkResponse)({ type: organisation_subscription_entity_1.OrganisationSubscriptionRecord }),
|
|
64
|
+
__param(0, (0, common_1.Param)("uuid")),
|
|
65
|
+
__param(1, (0, common_1.Body)()),
|
|
66
|
+
__metadata("design:type", Function),
|
|
67
|
+
__metadata("design:paramtypes", [String, saveSubscriptionDto_1.SaveOrganisationSubscriptionRecordDto]),
|
|
68
|
+
__metadata("design:returntype", Promise)
|
|
69
|
+
], OrganisationSubscriptionsController.prototype, "updateSubscription", null);
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, authz_1.MandatoryUserClaims)("modify:all"),
|
|
72
|
+
(0, common_1.Delete)(":uuid"),
|
|
73
|
+
(0, swagger_1.ApiOkResponse)({ type: [organisation_subscription_entity_1.OrganisationSubscriptionRecord] }),
|
|
74
|
+
__param(0, (0, common_1.Param)("uuid")),
|
|
75
|
+
__metadata("design:type", Function),
|
|
76
|
+
__metadata("design:paramtypes", [String]),
|
|
77
|
+
__metadata("design:returntype", Promise)
|
|
78
|
+
], OrganisationSubscriptionsController.prototype, "deleteSubscription", null);
|
|
39
79
|
OrganisationSubscriptionsController = __decorate([
|
|
40
|
-
(0, common_1.UseGuards)((0, passport_1.AuthGuard)("jwt")),
|
|
80
|
+
(0, common_1.UseGuards)((0, passport_1.AuthGuard)("jwt"), authz_1.ClaimsAuthorisationGuard),
|
|
41
81
|
(0, swagger_1.ApiBearerAuth)(),
|
|
42
82
|
(0, common_1.Controller)("organisation/:orgUuid/subscriptions"),
|
|
43
83
|
(0, swagger_1.ApiTags)("Organisations"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organisation-subscriptions.controller.js","sourceRoot":"","sources":["../../src/organisation-subscriptions/organisation-subscriptions.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"organisation-subscriptions.controller.js","sourceRoot":"","sources":["../../src/organisation-subscriptions/organisation-subscriptions.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAAgD;AAChD,2CAUwB;AACxB,6CAAsE;AACtE,+CAA2C;AAE3C,kGAA2F;AAC3F,6FAAqF;AACrF,oCAAuE;AACvE,sEAAmF;AAM5E,IAAM,mCAAmC,GAAzC,MAAM,mCAAmC;IACf;IAA7B,YAA6B,UAA2C;QAA3C,eAAU,GAAV,UAAU,CAAiC;IAAG,CAAC;IAItE,AAAN,KAAK,CAAC,OAAO,CACS,OAAe,EACtB,OAAwB;QAEnC,OAAO,IAAI,CAAC,UAAU,CAAC,oBAAoB,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1E,CAAC;IAKK,AAAN,KAAK,CAAC,eAAe,CAAS,IAA2C;QACrE,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IAKK,AAAN,KAAK,CAAC,kBAAkB,CACL,OAAe,EACtB,IAA2C;QAEnD,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACjD,C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CAAmC,CAkC/C;AAlCY,kFAAmC"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { Repository } from "typeorm";
|
|
2
2
|
import { Organisation } from "../organisation/entities/organisation.entity";
|
|
3
3
|
import { OrganisationSubscriptionRecord } from "./entities/organisation-subscription.entity";
|
|
4
|
+
import { SaveOrganisationSubscriptionRecordDto } from "./models/saveSubscriptionDto";
|
|
4
5
|
export declare class OrganisationSubscriptionService {
|
|
5
6
|
private orgRepo;
|
|
6
7
|
private orgSubRepository;
|
|
7
8
|
constructor(orgRepo: Repository<Organisation>, orgSubRepository: Repository<OrganisationSubscriptionRecord>);
|
|
8
9
|
findAllForOwnerOfOrg(orgUuid: string, currentUserId: number): Promise<OrganisationSubscriptionRecord[]>;
|
|
9
|
-
create(
|
|
10
|
+
create(subRecord: SaveOrganisationSubscriptionRecordDto): Promise<OrganisationSubscriptionRecord>;
|
|
11
|
+
update(subUuid: string, subRecord: SaveOrganisationSubscriptionRecordDto): Promise<OrganisationSubscriptionRecord>;
|
|
12
|
+
delete(subUuid: string): Promise<boolean>;
|
|
10
13
|
}
|
|
@@ -44,23 +44,46 @@ let OrganisationSubscriptionService = class OrganisationSubscriptionService {
|
|
|
44
44
|
});
|
|
45
45
|
return org.subscriptionRecords;
|
|
46
46
|
}
|
|
47
|
-
async create(
|
|
47
|
+
async create(subRecord) {
|
|
48
48
|
// find the org
|
|
49
|
-
await this.orgRepo.findOneOrFail({
|
|
49
|
+
const org = await this.orgRepo.findOneOrFail({
|
|
50
50
|
where: {
|
|
51
|
-
|
|
52
|
-
memberships: {
|
|
53
|
-
personId: currentUserId,
|
|
54
|
-
roles: {
|
|
55
|
-
name: RolesEnum_1.Roles.owner,
|
|
56
|
-
},
|
|
57
|
-
},
|
|
51
|
+
uuid: subRecord.organisationUuid,
|
|
58
52
|
},
|
|
59
|
-
|
|
60
|
-
|
|
53
|
+
});
|
|
54
|
+
const sub = this.orgSubRepository.create();
|
|
55
|
+
sub.organisationId = org.id;
|
|
56
|
+
sub.stripeCustomerId = subRecord.stripeCustomerId;
|
|
57
|
+
sub.stripePriceId = subRecord.stripePriceId;
|
|
58
|
+
sub.stripeSubscriptionId = subRecord.stripeSubscriptionId;
|
|
59
|
+
sub.validUntil = subRecord.validUntil;
|
|
60
|
+
return this.orgSubRepository.save(sub);
|
|
61
|
+
}
|
|
62
|
+
async update(subUuid, subRecord) {
|
|
63
|
+
const org = await this.orgRepo.findOneOrFail({
|
|
64
|
+
where: {
|
|
65
|
+
uuid: subRecord.organisationUuid,
|
|
61
66
|
},
|
|
62
67
|
});
|
|
63
|
-
|
|
68
|
+
const sub = await this.orgSubRepository.findOneOrFail({
|
|
69
|
+
where: {
|
|
70
|
+
uuid: subUuid,
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
sub.organisationId = org.id;
|
|
74
|
+
sub.stripeCustomerId = subRecord.stripeCustomerId;
|
|
75
|
+
sub.stripePriceId = subRecord.stripePriceId;
|
|
76
|
+
sub.stripeSubscriptionId = subRecord.stripeSubscriptionId;
|
|
77
|
+
sub.validUntil = subRecord.validUntil;
|
|
78
|
+
return this.orgSubRepository.save(sub);
|
|
79
|
+
}
|
|
80
|
+
async delete(subUuid) {
|
|
81
|
+
const result = await this.orgSubRepository.delete({
|
|
82
|
+
uuid: subUuid,
|
|
83
|
+
});
|
|
84
|
+
return (result.affected !== undefined &&
|
|
85
|
+
result.affected !== null &&
|
|
86
|
+
result.affected > 0);
|
|
64
87
|
}
|
|
65
88
|
};
|
|
66
89
|
OrganisationSubscriptionService = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organisation-subscriptions.service.js","sourceRoot":"","sources":["../../src/organisation-subscriptions/organisation-subscriptions.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA0C;AAC1C,6CAAiD;AACjD,qCAAmC;AACnC,6DAAoD;AACpD,sFAA0E;AAC1E,kGAA2F;
|
|
1
|
+
{"version":3,"file":"organisation-subscriptions.service.js","sourceRoot":"","sources":["../../src/organisation-subscriptions/organisation-subscriptions.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA0C;AAC1C,6CAAiD;AACjD,qCAAmC;AACnC,6DAAoD;AACpD,sFAA0E;AAC1E,kGAA2F;AAIpF,IAAM,+BAA+B,GAArC,MAAM,+BAA+B;IAG5B;IAEA;IAJZ,YAEY,OAAiC,EAEjC,gBAA4D;QAF5D,YAAO,GAAP,OAAO,CAA0B;QAEjC,qBAAgB,GAAhB,gBAAgB,CAA4C;IACrE,CAAC;IAEJ,KAAK,CAAC,oBAAoB,CACtB,OAAe,EACf,aAAqB;QAErB,oCAAoC;QACpC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;YACzC,KAAK,EAAE;gBACH,IAAI,EAAE,OAAO;gBACb,WAAW,EAAE;oBACT,QAAQ,EAAE,aAAa;oBACvB,KAAK,EAAE;wBACH,IAAI,EAAE,iBAAK,CAAC,KAAK;qBACpB;iBACJ;aACJ;YACD,SAAS,EAAE;gBACP,mBAAmB,EAAE,IAAI;aAC5B;SACJ,CAAC,CAAC;QAEH,OAAO,GAAG,CAAC,mBAAmB,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,MAAM,CACR,SAAgD;QAEhD,eAAe;QACf,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;YACzC,KAAK,EAAE;gBACH,IAAI,EAAE,SAAS,CAAC,gBAAgB;aACnC;SACJ,CAAC,CAAC;QAEH,MAAM,GAAG,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC;QAC3C,GAAG,CAAC,cAAc,GAAG,GAAG,CAAC,EAAE,CAAC;QAC5B,GAAG,CAAC,gBAAgB,GAAG,SAAS,CAAC,gBAAgB,CAAC;QAClD,GAAG,CAAC,aAAa,GAAG,SAAS,CAAC,aAAa,CAAC;QAC5C,GAAG,CAAC,oBAAoB,GAAG,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