@darraghor/nest-backend-libs 1.49.0 → 2.0.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.
Files changed (78) hide show
  1. package/dist/authz/authzstrategy.js +2 -2
  2. package/dist/authz/authzstrategy.js.map +1 -1
  3. package/dist/core-config/CoreConfigurationService.d.ts +1 -2
  4. package/dist/core-config/CoreConfigurationService.js +3 -12
  5. package/dist/core-config/CoreConfigurationService.js.map +1 -1
  6. package/dist/core-config/CoreConfigurationVariables.d.ts +2 -4
  7. package/dist/core-config/CoreConfigurationVariables.js +1 -2
  8. package/dist/core-config/CoreConfigurationVariables.js.map +1 -1
  9. package/dist/database-postgres/PostgresDatabaseConfigurationService.d.ts +0 -2
  10. package/dist/database-postgres/PostgresDatabaseConfigurationService.js +0 -2
  11. package/dist/database-postgres/PostgresDatabaseConfigurationService.js.map +1 -1
  12. package/dist/organisation/dto/RolesEnum.d.ts +4 -0
  13. package/dist/organisation/dto/RolesEnum.js +10 -0
  14. package/dist/organisation/dto/RolesEnum.js.map +1 -0
  15. package/dist/organisation/entities/member-role.entity.d.ts +10 -0
  16. package/dist/organisation/entities/member-role.entity.js +60 -0
  17. package/dist/organisation/entities/member-role.entity.js.map +1 -0
  18. package/dist/organisation/entities/organisation-membership.entity.d.ts +16 -0
  19. package/dist/organisation/entities/organisation-membership.entity.js +105 -0
  20. package/dist/organisation/entities/organisation-membership.entity.js.map +1 -0
  21. package/dist/organisation/entities/organisation.entity.d.ts +2 -4
  22. package/dist/organisation/entities/organisation.entity.js +7 -23
  23. package/dist/organisation/entities/organisation.entity.js.map +1 -1
  24. package/dist/organisation/organisation.service.js +73 -17
  25. package/dist/organisation/organisation.service.js.map +1 -1
  26. package/dist/person/entities/person.entity.d.ts +2 -3
  27. package/dist/person/entities/person.entity.js +6 -17
  28. package/dist/person/entities/person.entity.js.map +1 -1
  29. package/dist/person/person.service.js +33 -11
  30. package/dist/person/person.service.js.map +1 -1
  31. package/dist/root-app/core-app.module.js +4 -2
  32. package/dist/root-app/core-app.module.js.map +1 -1
  33. package/dist/smtp-email-client/EmailConfigurationService.d.ts +1 -1
  34. package/dist/smtp-email-client/EmailConfigurationService.js +3 -3
  35. package/dist/smtp-email-client/EmailConfigurationService.js.map +1 -1
  36. package/dist/smtp-email-client/EmailConfigurationVariables.d.ts +2 -2
  37. package/dist/smtp-email-client/EmailConfigurationVariables.js +1 -1
  38. package/dist/smtp-email-client/EmailConfigurationVariables.js.map +1 -1
  39. package/dist/smtp-email-client/email-client.service.d.ts +4 -2
  40. package/dist/smtp-email-client/email-client.service.js +20 -26
  41. package/dist/smtp-email-client/email-client.service.js.map +1 -1
  42. package/dist/smtp-email-client/email.entity.d.ts +3 -1
  43. package/dist/smtp-email-client/email.entity.js +12 -2
  44. package/dist/smtp-email-client/email.entity.js.map +1 -1
  45. package/dist/smtp-email-client/smtp-email-client.module.d.ts +1 -0
  46. package/dist/smtp-email-client/smtp-email-client.module.js +8 -1
  47. package/dist/smtp-email-client/smtp-email-client.module.js.map +1 -1
  48. package/dist/smtp-email-client/smtp-email-handler.d.ts +17 -0
  49. package/dist/smtp-email-client/smtp-email-handler.js +108 -0
  50. package/dist/smtp-email-client/smtp-email-handler.js.map +1 -0
  51. package/dist/stripe-client/StripeClientConfigurationService.d.ts +9 -0
  52. package/dist/stripe-client/StripeClientConfigurationService.js +56 -0
  53. package/dist/stripe-client/StripeClientConfigurationService.js.map +1 -0
  54. package/dist/stripe-client/StripeClientProvider.d.ts +7 -0
  55. package/dist/stripe-client/StripeClientProvider.js +22 -0
  56. package/dist/stripe-client/StripeClientProvider.js.map +1 -0
  57. package/dist/stripe-client/StripeConfigurationVariables.d.ts +10 -0
  58. package/dist/stripe-client/StripeConfigurationVariables.js +9 -0
  59. package/dist/stripe-client/StripeConfigurationVariables.js.map +1 -0
  60. package/dist/stripe-client/models/StripeCheckoutSessionParams.d.ts +11 -0
  61. package/dist/stripe-client/models/StripeCheckoutSessionParams.js +63 -0
  62. package/dist/stripe-client/models/StripeCheckoutSessionParams.js.map +1 -0
  63. package/dist/stripe-client/services/stripe-checkout.service.d.ts +15 -0
  64. package/dist/stripe-client/services/stripe-checkout.service.js +65 -0
  65. package/dist/stripe-client/services/stripe-checkout.service.js.map +1 -0
  66. package/dist/stripe-client/services/stripe-event-handler.d.ts +11 -0
  67. package/dist/stripe-client/services/stripe-event-handler.js +148 -0
  68. package/dist/stripe-client/services/stripe-event-handler.js.map +1 -0
  69. package/dist/stripe-client/services/stripe-webhook-handler.service.d.ts +14 -0
  70. package/dist/stripe-client/services/stripe-webhook-handler.service.js +56 -0
  71. package/dist/stripe-client/services/stripe-webhook-handler.service.js.map +1 -0
  72. package/dist/stripe-client/stripe-account.module.d.ts +4 -0
  73. package/dist/stripe-client/stripe-account.module.js +44 -0
  74. package/dist/stripe-client/stripe-account.module.js.map +1 -0
  75. package/dist/stripe-client/stripe-controller.d.ts +14 -0
  76. package/dist/stripe-client/stripe-controller.js +86 -0
  77. package/dist/stripe-client/stripe-controller.js.map +1 -0
  78. package/package.json +20 -17
@@ -29,13 +29,13 @@ let JwtStrategy = class JwtStrategy extends (0, passport_1.PassportStrategy)(pas
29
29
  cache: true,
30
30
  rateLimit: true,
31
31
  jwksRequestsPerMinute: 5,
32
- jwksUri: `${config.auth0Domain}/.well-known/jwks.json`,
32
+ jwksUri: `https://${config.auth0Domain}/.well-known/jwks.json`,
33
33
  }),
34
34
  passReqToCallback: true,
35
35
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
36
36
  jwtFromRequest: passport_jwt_1.ExtractJwt.fromAuthHeaderAsBearerToken(),
37
37
  audience: config.auth0Audience,
38
- issuer: `${config.auth0Domain}/`,
38
+ issuer: `https://${config.auth0Domain}/`,
39
39
  algorithms: ["RS256"],
40
40
  });
41
41
  this.personService = personService;
@@ -1 +1 @@
1
- {"version":3,"file":"authzstrategy.js","sourceRoot":"","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ChB,yBAAU,CAAC,2BAA2B,EAAE,CAAC,OAAO,CAAC,CAAC;QACtD,IAAI,cAAc,KAAK,SAAS,IAAI,cAAc,KAAK,IAAI,EAAE;YACzD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;YACvD,OAAO;SACV;QAED,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,YAAY,CACtD,OAAO,EACP,cAAc,CACjB,CAAC;QAEF,MAAM,eAAe,GAAG,EAAC,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,EAAE,EAAC,CAAC;QACjE,2DAA2D;QAC3D,MAAM,EAAE,GAAG,EAAC,GAAG,YAAY,EAAE,GAAG,eAAe,EAAkB,CAAC;QAClE,OAAO,EAAE,CAAC;IACd,CAAC;CACJ,CAAA;AA9CY,WAAW;IADvB,IAAA,mBAAU,GAAE;qCAM2B,8BAAa;QACpB,2BAAiB;QAClC,mDAAwB;GAP3B,WAAW,CA8CvB;AA9CY,kCAAW"}
@@ -7,8 +7,7 @@ export declare class CoreConfigurationService extends ValidatedConfigurationServ
7
7
  get shouldAutomaticallyInstallApiModels(): boolean;
8
8
  get shouldUseNestCors(): boolean;
9
9
  get webPort(): number;
10
- get clientCorsUrl(): string;
11
10
  get appTitle(): string;
12
- get appEnvironmentSpecificUrl(): string;
11
+ get frontEndAppUrl(): string;
13
12
  get nodeEnv(): string;
14
13
  }
@@ -33,14 +33,11 @@ let CoreConfigurationService = class CoreConfigurationService extends ValidatedC
33
33
  get webPort() {
34
34
  return Number.parseInt(this.configService.get("core.webPort"), 10);
35
35
  }
36
- get clientCorsUrl() {
37
- return this.configService.get("core.clientCorsUrl");
38
- }
39
36
  get appTitle() {
40
37
  return this.configService.get("core.appTitle");
41
38
  }
42
- get appEnvironmentSpecificUrl() {
43
- return this.configService.get("core.appEnvironmentSpecificUrl");
39
+ get frontEndAppUrl() {
40
+ return this.configService.get("core.frontEndAppUrl");
44
41
  }
45
42
  get nodeEnv() {
46
43
  return this.configService.get("core.nodeEnv");
@@ -70,12 +67,6 @@ __decorate([
70
67
  __metadata("design:type", Number),
71
68
  __metadata("design:paramtypes", [])
72
69
  ], CoreConfigurationService.prototype, "webPort", null);
73
- __decorate([
74
- (0, class_validator_1.IsDefined)(),
75
- (0, class_validator_1.IsString)(),
76
- __metadata("design:type", String),
77
- __metadata("design:paramtypes", [])
78
- ], CoreConfigurationService.prototype, "clientCorsUrl", null);
79
70
  __decorate([
80
71
  (0, class_validator_1.IsDefined)(),
81
72
  (0, class_validator_1.IsString)(),
@@ -87,7 +78,7 @@ __decorate([
87
78
  (0, class_validator_1.IsString)(),
88
79
  __metadata("design:type", String),
89
80
  __metadata("design:paramtypes", [])
90
- ], CoreConfigurationService.prototype, "appEnvironmentSpecificUrl", null);
81
+ ], CoreConfigurationService.prototype, "frontEndAppUrl", null);
91
82
  __decorate([
92
83
  (0, class_validator_1.IsDefined)(),
93
84
  (0, class_validator_1.IsString)(),
@@ -1 +1 @@
1
- {"version":3,"file":"CoreConfigurationService.js","sourceRoot":"","sources":["../../src/core-config/CoreConfigurationService.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6DAA6D;AAC7D,2CAA0C;AAC1C,2CAA6C;AAC7C,qDAAsE;AACtE,kGAA6F;AAGtF,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,6DAA6B;IACvE,YAAoB,aAA4B;QAC5C,KAAK,EAAE,CAAC;QADQ,kBAAa,GAAb,aAAa,CAAe;IAEhD,CAAC;IAED,IAEI,qBAAqB;QACrB,OAAO,CACH,IAAI,CAAC,aAAa,CAAC,GAAG,CAAS,4BAA4B,CAAC;YAC5D,MAAM,CACT,CAAC;IACN,CAAC;IAED,IAEI,mCAAmC;QACnC,OAAO,CACH,IAAI,CAAC,aAAa,CAAC,GAAG,CAClB,0CAA0C,CAC7C,KAAK,MAAM,CACf,CAAC;IACN,CAAC;IAED,IAEI,iBAAiB;QACjB,OAAO,CACH,IAAI,CAAC,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":3,"file":"CoreConfigurationService.js","sourceRoot":"","sources":["../../src/core-config/CoreConfigurationService.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6DAA6D;AAC7D,2CAA0C;AAC1C,2CAA6C;AAC7C,qDAAsE;AACtE,kGAA6F;AAGtF,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,6DAA6B;IACvE,YAAoB,aAA4B;QAC5C,KAAK,EAAE,CAAC;QADQ,kBAAa,GAAb,aAAa,CAAe;IAEhD,CAAC;IAED,IAEI,qBAAqB;QACrB,OAAO,CACH,IAAI,CAAC,aAAa,CAAC,GAAG,CAAS,4BAA4B,CAAC;YAC5D,MAAM,CACT,CAAC;IACN,CAAC;IAED,IAEI,mCAAmC;QACnC,OAAO,CACH,IAAI,CAAC,aAAa,CAAC,GAAG,CAClB,0CAA0C,CAC7C,KAAK,MAAM,CACf,CAAC;IACN,CAAC;IAED,IAEI,iBAAiB;QACjB,OAAO,CACH,IAAI,CAAC,aAAa,CAAC,GAAG,CAAS,wBAAwB,CAAC,KAAK,MAAM,CACtE,CAAC;IACN,CAAC;IAED,IAEI,OAAO;QACP,OAAO,MAAM,CAAC,QAAQ,CAClB,IAAI,CAAC,aAAa,CAAC,GAAG,CAAS,cAAc,CAAE,EAC/C,EAAE,CACL,CAAC;IACN,CAAC;IAED,IAEI,QAAQ;QACR,OAAO,IAAI,CAAC,aAAa,CAAC,GAAG,CAAS,eAAe,CAAE,CAAC;IAC5D,CAAC;IAED,IAEI,cAAc;QACd,OAAO,IAAI,CAAC,aAAa,CAAC,GAAG,CAAS,qBAAqB,CAAE,CAAC;IAClE,CAAC;IAED,IAEI,OAAO;QACP,OAAO,IAAI,CAAC,aAAa,CAAC,GAAG,CAAS,cAAc,CAAE,CAAC;IAC3D,CAAC;CACJ,CAAA;AArDG;IAAC,IAAA,2BAAS,GAAE;IACX,IAAA,2BAAS,GAAE;;;qEAMX;AAED;IAAC,IAAA,2BAAS,GAAE;IACX,IAAA,2BAAS,GAAE;;;mFAOX;AAED;IAAC,IAAA,2BAAS,GAAE;IACX,IAAA,2BAAS,GAAE;;;iEAKX;AAED;IAAC,IAAA,2BAAS,GAAE;IACX,IAAA,uBAAK,GAAE;;;uDAMP;AAED;IAAC,IAAA,2BAAS,GAAE;IACX,IAAA,0BAAQ,GAAE;;;wDAGV;AAED;IAAC,IAAA,2BAAS,GAAE;IACX,IAAA,0BAAQ,GAAE;;;8DAGV;AAED;IAAC,IAAA,2BAAS,GAAE;IACX,IAAA,0BAAQ,GAAE;;;uDAGV;AAzDQ,wBAAwB;IADpC,IAAA,mBAAU,GAAE;qCAE0B,sBAAa;GADvC,wBAAwB,CA0DpC;AA1DY,4DAAwB"}
@@ -3,8 +3,7 @@ declare const _default: (() => {
3
3
  shouldGenerateSwagger: string | undefined;
4
4
  webPort: string | undefined;
5
5
  nodeEnv: string | undefined;
6
- clientCorsUrl: string | undefined;
7
- appEnvironmentSpecificUrl: string | undefined;
6
+ frontEndAppUrl: string | undefined;
8
7
  shouldUseNestCors: string | undefined;
9
8
  shouldAutomaticallyInstallApiModels: string | undefined;
10
9
  appTitle: string | undefined;
@@ -13,8 +12,7 @@ declare const _default: (() => {
13
12
  shouldGenerateSwagger: string | undefined;
14
13
  webPort: string | undefined;
15
14
  nodeEnv: string | undefined;
16
- clientCorsUrl: string | undefined;
17
- appEnvironmentSpecificUrl: string | undefined;
15
+ frontEndAppUrl: string | undefined;
18
16
  shouldUseNestCors: string | undefined;
19
17
  shouldAutomaticallyInstallApiModels: string | undefined;
20
18
  appTitle: string | undefined;
@@ -6,8 +6,7 @@ exports.default = (0, config_1.registerAs)("core", () => ({
6
6
  shouldGenerateSwagger: process.env.GENERATE_SWAGGER,
7
7
  webPort: process.env.WEB_PORT,
8
8
  nodeEnv: process.env.NODE_ENV,
9
- clientCorsUrl: process.env.CLIENT_CORS_URL,
10
- appEnvironmentSpecificUrl: process.env.APP_ENVIRONMENT_SPECIFIC_URL,
9
+ frontEndAppUrl: process.env.FRONTEND_APP_URL,
11
10
  shouldUseNestCors: process.env.ENABLE_NEST_CORS,
12
11
  shouldAutomaticallyInstallApiModels: process.env.AUTO_INSTALL_API_MODELS,
13
12
  appTitle: process.env.APP_TITLE,
@@ -1 +1 @@
1
- {"version":3,"file":"CoreConfigurationVariables.js","sourceRoot":"","sources":["../../src/core-config/CoreConfigurationVariables.ts"],"names":[],"mappings":";;AAAA,2CAA0C;AAE1C,kBAAe,IAAA,mBAAU,EAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;IACrC,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW;IACnC,qBAAqB,EAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB;IACnD,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ;IAC7B,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ;IAC7B,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe;IAC1C,yBAAyB,EAAE,OAAO,CAAC,GAAG,CAAC,4BAA4B;IACnE,iBAAiB,EAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB;IAC/C,mCAAmC,EAAE,OAAO,CAAC,GAAG,CAAC,uBAAuB;IACxE,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS;CAClC,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"CoreConfigurationVariables.js","sourceRoot":"","sources":["../../src/core-config/CoreConfigurationVariables.ts"],"names":[],"mappings":";;AAAA,2CAA0C;AAE1C,kBAAe,IAAA,mBAAU,EAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;IACrC,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW;IACnC,qBAAqB,EAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB;IACnD,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ;IAC7B,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ;IAC7B,cAAc,EAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB;IAC5C,iBAAiB,EAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB;IAC/C,mCAAmC,EAAE,OAAO,CAAC,GAAG,CAAC,uBAAuB;IACxE,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS;CAClC,CAAC,CAAC,CAAC"}
@@ -1,8 +1,6 @@
1
1
  import { TypeOrmModuleOptions } from "@nestjs/typeorm";
2
2
  export declare class DatabaseConfigurationService {
3
3
  /**
4
- * This method uses process.env directly because it is also used in a node script that doesn't have access
5
- * to NestJS injection.
6
4
  * @returns {TypeOrmModuleOptions} Database config for the current env
7
5
  */
8
6
  getTypeOrmConfig(): TypeOrmModuleOptions;
@@ -11,8 +11,6 @@ const common_1 = require("@nestjs/common");
11
11
  const PostgresTypeOrmConfigurationProvider_1 = require("./PostgresTypeOrmConfigurationProvider");
12
12
  let DatabaseConfigurationService = class DatabaseConfigurationService {
13
13
  /**
14
- * This method uses process.env directly because it is also used in a node script that doesn't have access
15
- * to NestJS injection.
16
14
  * @returns {TypeOrmModuleOptions} Database config for the current env
17
15
  */
18
16
  getTypeOrmConfig() {
@@ -1 +1 @@
1
- {"version":3,"file":"PostgresDatabaseConfigurationService.js","sourceRoot":"","sources":["../../src/database-postgres/PostgresDatabaseConfigurationService.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA0C;AAE1C,iGAA4F;AAGrF,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IACrC;;;;OAIG;IACI,gBAAgB;QACnB,OAAO,2EAAoC,CAAC,gBAAgB,EAAE,CAAC;IACnE,CAAC;CACJ,CAAA;AATY,4BAA4B;IADxC,IAAA,mBAAU,GAAE;GACA,4BAA4B,CASxC;AATY,oEAA4B"}
1
+ {"version":3,"file":"PostgresDatabaseConfigurationService.js","sourceRoot":"","sources":["../../src/database-postgres/PostgresDatabaseConfigurationService.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA0C;AAE1C,iGAA4F;AAGrF,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IACrC;;OAEG;IACI,gBAAgB;QACnB,OAAO,2EAAoC,CAAC,gBAAgB,EAAE,CAAC;IACnE,CAAC;CACJ,CAAA;AAPY,4BAA4B;IADxC,IAAA,mBAAU,GAAE;GACA,4BAA4B,CAOxC;AAPY,oEAA4B"}
@@ -0,0 +1,4 @@
1
+ export declare enum Roles {
2
+ owner = "owner",
3
+ member = "member"
4
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Roles = void 0;
4
+ /* eslint-disable @typescript-eslint/naming-convention */
5
+ var Roles;
6
+ (function (Roles) {
7
+ Roles["owner"] = "owner";
8
+ Roles["member"] = "member";
9
+ })(Roles = exports.Roles || (exports.Roles = {}));
10
+ //# sourceMappingURL=RolesEnum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RolesEnum.js","sourceRoot":"","sources":["../../../src/organisation/dto/RolesEnum.ts"],"names":[],"mappings":";;;AAAA,yDAAyD;AACzD,IAAY,KAGX;AAHD,WAAY,KAAK;IACb,wBAAe,CAAA;IACf,0BAAiB,CAAA;AACrB,CAAC,EAHW,KAAK,GAAL,aAAK,KAAL,aAAK,QAGhB"}
@@ -0,0 +1,10 @@
1
+ import { OrganisationMembership } from "./organisation-membership.entity";
2
+ export declare class MembershipRole {
3
+ id: number;
4
+ membership: OrganisationMembership;
5
+ membershipId: number;
6
+ name: string;
7
+ createdDate: Date;
8
+ updateDate: Date;
9
+ deletedDate: Date;
10
+ }
@@ -0,0 +1,60 @@
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.MembershipRole = void 0;
13
+ const swagger_1 = require("@nestjs/swagger");
14
+ const typeorm_1 = require("typeorm");
15
+ const organisation_membership_entity_1 = require("./organisation-membership.entity");
16
+ let MembershipRole = class MembershipRole {
17
+ };
18
+ __decorate([
19
+ (0, typeorm_1.PrimaryGeneratedColumn)(),
20
+ (0, swagger_1.ApiProperty)(),
21
+ __metadata("design:type", Number)
22
+ ], MembershipRole.prototype, "id", void 0);
23
+ __decorate([
24
+ (0, typeorm_1.ManyToOne)(() => organisation_membership_entity_1.OrganisationMembership, (membership) => membership.roles, {
25
+ eager: true,
26
+ cascade: true,
27
+ }),
28
+ (0, typeorm_1.Index)(),
29
+ (0, typeorm_1.JoinColumn)(),
30
+ __metadata("design:type", organisation_membership_entity_1.OrganisationMembership)
31
+ ], MembershipRole.prototype, "membership", void 0);
32
+ __decorate([
33
+ (0, typeorm_1.Column)(),
34
+ (0, typeorm_1.RelationId)((membership) => membership.membership),
35
+ __metadata("design:type", Number)
36
+ ], MembershipRole.prototype, "membershipId", void 0);
37
+ __decorate([
38
+ (0, typeorm_1.Column)(),
39
+ __metadata("design:type", String)
40
+ ], MembershipRole.prototype, "name", void 0);
41
+ __decorate([
42
+ (0, typeorm_1.CreateDateColumn)(),
43
+ (0, swagger_1.ApiProperty)(),
44
+ __metadata("design:type", Date)
45
+ ], MembershipRole.prototype, "createdDate", void 0);
46
+ __decorate([
47
+ (0, typeorm_1.UpdateDateColumn)(),
48
+ (0, swagger_1.ApiProperty)(),
49
+ __metadata("design:type", Date)
50
+ ], MembershipRole.prototype, "updateDate", void 0);
51
+ __decorate([
52
+ (0, typeorm_1.DeleteDateColumn)(),
53
+ (0, swagger_1.ApiProperty)(),
54
+ __metadata("design:type", Date)
55
+ ], MembershipRole.prototype, "deletedDate", void 0);
56
+ MembershipRole = __decorate([
57
+ (0, typeorm_1.Entity)()
58
+ ], MembershipRole);
59
+ exports.MembershipRole = MembershipRole;
60
+ //# sourceMappingURL=member-role.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"member-role.entity.js","sourceRoot":"","sources":["../../../src/organisation/entities/member-role.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA4C;AAE5C,qCAWiB;AACjB,qFAAwE;AAGjE,IAAM,cAAc,GAApB,MAAM,cAAc;CA+B1B,CAAA;AA9BG;IAAC,IAAA,gCAAsB,GAAE;IACxB,IAAA,qBAAW,GAAE;;0CACF;AAEZ;IAAC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,uDAAsB,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE;QACvE,KAAK,EAAE,IAAI;QACX,OAAO,EAAE,IAAI;KAChB,CAAC;IACD,IAAA,eAAK,GAAE;IACP,IAAA,oBAAU,GAAE;8BACA,uDAAsB;kDAAC;AAEpC;IAAC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAU,EAAC,CAAC,UAA0B,EAAE,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC;;oDACrC;AAE7B;IAAC,IAAA,gBAAM,GAAE;;4CACK;AAEd;IAAC,IAAA,0BAAgB,GAAE;IAClB,IAAA,qBAAW,GAAE;8BACA,IAAI;mDAAC;AAEnB;IAAC,IAAA,0BAAgB,GAAE;IAClB,IAAA,qBAAW,GAAE;8BACD,IAAI;kDAAC;AAElB;IAAC,IAAA,0BAAgB,GAAE;IAClB,IAAA,qBAAW,GAAE;8BACA,IAAI;mDAAC;AA9BV,cAAc;IAD1B,IAAA,gBAAM,GAAE;GACI,cAAc,CA+B1B;AA/BY,wCAAc"}
@@ -0,0 +1,16 @@
1
+ import { Organisation } from "../../organisation/entities/organisation.entity";
2
+ import { Person } from "../../person/entities/person.entity";
3
+ import { MembershipRole } from "./member-role.entity";
4
+ export declare class OrganisationMembership {
5
+ id: number;
6
+ uuid: string;
7
+ person: Person;
8
+ personId: number;
9
+ organisation: Organisation;
10
+ organisationId: number;
11
+ roles: MembershipRole[];
12
+ createdDate: Date;
13
+ updateDate: Date;
14
+ deletedDate: Date;
15
+ nullChecks(): Promise<void>;
16
+ }
@@ -0,0 +1,105 @@
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.OrganisationMembership = void 0;
13
+ const swagger_1 = require("@nestjs/swagger");
14
+ const class_transformer_1 = require("class-transformer");
15
+ const typeorm_1 = require("typeorm");
16
+ const organisation_entity_1 = require("../../organisation/entities/organisation.entity");
17
+ const person_entity_1 = require("../../person/entities/person.entity");
18
+ const member_role_entity_1 = require("./member-role.entity");
19
+ let OrganisationMembership = class OrganisationMembership {
20
+ // eslint-disable-next-line @typescript-eslint/require-await
21
+ async nullChecks() {
22
+ if (!this.roles) {
23
+ this.roles = [];
24
+ }
25
+ }
26
+ };
27
+ __decorate([
28
+ (0, typeorm_1.PrimaryGeneratedColumn)(),
29
+ (0, swagger_1.ApiProperty)(),
30
+ __metadata("design:type", Number)
31
+ ], OrganisationMembership.prototype, "id", void 0);
32
+ __decorate([
33
+ (0, typeorm_1.Column)("uuid", {
34
+ name: "uuid",
35
+ default: () => "uuid_generate_v4()",
36
+ }),
37
+ (0, typeorm_1.Generated)("uuid"),
38
+ (0, swagger_1.ApiProperty)(),
39
+ __metadata("design:type", String)
40
+ ], OrganisationMembership.prototype, "uuid", void 0);
41
+ __decorate([
42
+ (0, typeorm_1.ManyToOne)(() => person_entity_1.Person, (person) => person.memberships, {
43
+ eager: true,
44
+ cascade: ["insert", "update"],
45
+ }),
46
+ (0, class_transformer_1.Exclude)(),
47
+ (0, typeorm_1.JoinColumn)(),
48
+ __metadata("design:type", person_entity_1.Person)
49
+ ], OrganisationMembership.prototype, "person", void 0);
50
+ __decorate([
51
+ (0, typeorm_1.Column)(),
52
+ (0, typeorm_1.RelationId)((membership) => membership.person),
53
+ __metadata("design:type", Number)
54
+ ], OrganisationMembership.prototype, "personId", void 0);
55
+ __decorate([
56
+ (0, typeorm_1.ManyToOne)(() => organisation_entity_1.Organisation, (org) => org.memberships, {
57
+ eager: true,
58
+ cascade: ["insert", "update"],
59
+ }),
60
+ (0, class_transformer_1.Exclude)(),
61
+ (0, typeorm_1.JoinColumn)(),
62
+ __metadata("design:type", organisation_entity_1.Organisation)
63
+ ], OrganisationMembership.prototype, "organisation", void 0);
64
+ __decorate([
65
+ (0, typeorm_1.Column)(),
66
+ (0, typeorm_1.RelationId)((membership) => membership.organisation),
67
+ __metadata("design:type", Number)
68
+ ], OrganisationMembership.prototype, "organisationId", void 0);
69
+ __decorate([
70
+ (0, typeorm_1.OneToMany)(() => member_role_entity_1.MembershipRole, (role) => role.membership, {
71
+ eager: true,
72
+ cascade: true,
73
+ }),
74
+ (0, typeorm_1.Index)(),
75
+ (0, typeorm_1.JoinColumn)(),
76
+ __metadata("design:type", Array)
77
+ ], OrganisationMembership.prototype, "roles", void 0);
78
+ __decorate([
79
+ (0, typeorm_1.CreateDateColumn)(),
80
+ (0, swagger_1.ApiProperty)(),
81
+ __metadata("design:type", Date)
82
+ ], OrganisationMembership.prototype, "createdDate", void 0);
83
+ __decorate([
84
+ (0, typeorm_1.UpdateDateColumn)(),
85
+ (0, swagger_1.ApiProperty)(),
86
+ __metadata("design:type", Date)
87
+ ], OrganisationMembership.prototype, "updateDate", void 0);
88
+ __decorate([
89
+ (0, typeorm_1.DeleteDateColumn)(),
90
+ (0, swagger_1.ApiProperty)(),
91
+ __metadata("design:type", Date)
92
+ ], OrganisationMembership.prototype, "deletedDate", void 0);
93
+ __decorate([
94
+ (0, typeorm_1.AfterLoad)(),
95
+ (0, typeorm_1.AfterInsert)(),
96
+ (0, typeorm_1.AfterUpdate)(),
97
+ __metadata("design:type", Function),
98
+ __metadata("design:paramtypes", []),
99
+ __metadata("design:returntype", Promise)
100
+ ], OrganisationMembership.prototype, "nullChecks", null);
101
+ OrganisationMembership = __decorate([
102
+ (0, typeorm_1.Entity)()
103
+ ], OrganisationMembership);
104
+ exports.OrganisationMembership = OrganisationMembership;
105
+ //# sourceMappingURL=organisation-membership.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organisation-membership.entity.js","sourceRoot":"","sources":["../../../src/organisation/entities/organisation-membership.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA4C;AAC5C,yDAA0C;AAC1C,qCAgBiB;AACjB,yFAA6E;AAC7E,uEAA2D;AAC3D,6DAAoD;AAG7C,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IAyD/B,4DAA4D;IAItD,AAAN,KAAK,CAAC,UAAU;QACZ,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;YACb,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;SACnB;IACL,CAAC;CACJ,CAAA;AAjEG;IAAC,IAAA,gCAAsB,GAAE;IACxB,IAAA,qBAAW,GAAE;;kDACF;AAEZ;IAAC,IAAA,gBAAM,EAAC,MAAM,EAAE;QACZ,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,GAAG,EAAE,CAAC,oB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AW,GAAE;8BACD,IAAI;0DAAC;AAElB;IAAC,IAAA,0BAAgB,GAAE;IAClB,IAAA,qBAAW,GAAE;8BACA,IAAI;2DAAC;AAMb;IAHL,IAAA,mBAAS,GAAE;IACX,IAAA,qBAAW,GAAE;IACb,IAAA,qBAAW,GAAE;;;;wDAKb;AAjEQ,sBAAsB;IADlC,IAAA,gBAAM,GAAE;GACI,sBAAsB,CAkElC;AAlEY,wDAAsB"}
@@ -1,10 +1,8 @@
1
- import { Person } from "../../person/entities/person.entity";
1
+ import { OrganisationMembership } from "./organisation-membership.entity";
2
2
  export declare class Organisation {
3
3
  id: number;
4
4
  uuid: string;
5
- members: Person[];
6
- owner: Person;
7
- ownerId: number;
5
+ memberships: OrganisationMembership[];
8
6
  name: string;
9
7
  createdDate: Date;
10
8
  updateDate: Date;
@@ -11,14 +11,13 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.Organisation = void 0;
13
13
  const swagger_1 = require("@nestjs/swagger");
14
- const class_transformer_1 = require("class-transformer");
15
14
  const typeorm_1 = require("typeorm");
16
- const person_entity_1 = require("../../person/entities/person.entity");
15
+ const organisation_membership_entity_1 = require("./organisation-membership.entity");
17
16
  let Organisation = class Organisation {
18
17
  // eslint-disable-next-line @typescript-eslint/require-await
19
18
  async nullChecks() {
20
- if (!this.members) {
21
- this.members = [];
19
+ if (!this.memberships) {
20
+ this.memberships = [];
22
21
  }
23
22
  }
24
23
  };
@@ -37,28 +36,13 @@ __decorate([
37
36
  __metadata("design:type", String)
38
37
  ], Organisation.prototype, "uuid", void 0);
39
38
  __decorate([
40
- (0, typeorm_1.ManyToMany)(() => person_entity_1.Person, (orgMember) => orgMember.memberOfOrganisations, {
39
+ (0, typeorm_1.OneToMany)(() => organisation_membership_entity_1.OrganisationMembership, (om) => om.organisation, {
41
40
  eager: true,
42
- onDelete: "CASCADE",
43
- }),
44
- (0, class_transformer_1.Exclude)(),
45
- (0, typeorm_1.JoinTable)(),
46
- __metadata("design:type", Array)
47
- ], Organisation.prototype, "members", void 0);
48
- __decorate([
49
- (0, typeorm_1.ManyToOne)(() => person_entity_1.Person, (person) => person.ownerOfOrganisations, {
50
- eager: true,
51
- onDelete: "CASCADE",
41
+ cascade: ["insert", "update"],
52
42
  }),
53
43
  (0, typeorm_1.Index)(),
54
- (0, typeorm_1.JoinColumn)(),
55
- __metadata("design:type", person_entity_1.Person)
56
- ], Organisation.prototype, "owner", void 0);
57
- __decorate([
58
- (0, typeorm_1.RelationId)((organisation) => organisation.owner),
59
- (0, swagger_1.ApiProperty)(),
60
- __metadata("design:type", Number)
61
- ], Organisation.prototype, "ownerId", void 0);
44
+ __metadata("design:type", Array)
45
+ ], Organisation.prototype, "memberships", void 0);
62
46
  __decorate([
63
47
  (0, typeorm_1.Column)(),
64
48
  (0, swagger_1.ApiProperty)(),
@@ -1 +1 @@
1
- {"version":3,"file":"organisation.entity.js","sourceRoot":"","sources":["../../../src/organisation/entities/organisation.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA4C;AAC5C,yDAA0C;AAC1C,qCAiBiB;AACjB,uEAA2D;AAGpD,IAAM,YAAY,GAAlB,MAAM,YAAY;IAiDrB,4DAA4D;IAItD,AAAN,KAAK,CAAC,UAAU;QACZ,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACf,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;SACrB;IACL,CAAC;CACJ,CAAA;AAzDG;IAAC,IAAA,gCAAsB,GAAE;IACxB,IAAA,qBAAW,GAAE;;wCACF;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;;0CACO;AAErB;IAAC,IAAA,oBAAU,EAAC,GAAG,EAAE,CAAC,sBAAM,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,qBAAqB,EAAE;QACtE,KAAK,EAAE,IAAI;QACX,QAAQ,EAAE,SAAS;KACtB,CAAC;IACD,IAAA,2BAAO,GAAE;IACT,IAAA,mBAAS,GAAE;;6CACO;AAEnB;IAAC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,sBAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,oBAAoB,EAAE;QAC9D,KAAK,EAAE,IAAI;QACX,QAAQ,EAAE,SAAS;KACtB,CAAC;IACD,IAAA,eAAK,GAAE;IACP,IAAA,oBAAU,GAAE;8BACL,sBAAM;2CAAC;AAEf;IAAC,IAAA,oBAAU,EAAC,CAAC,YAA0B,EAAE,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC;IAC9D,IAAA,qBAAW,GAAE;;6CACG;AAEjB;IAAC,IAAA,gBAAM,GAAE;IACR,IAAA,qBAAW,GAAE;;0CACA;AAEd;IAAC,IAAA,0BAAgB,GAAE;IAClB,IAAA,qBAAW,GAAE;8BACA,IAAI;iDAAC;AAEnB;IAAC,IAAA,0BAAgB,GAAE;IAClB,IAAA,qBAAW,GAAE;8BACD,IAAI;gDAAC;AAElB;IAAC,IAAA,0BAAgB,GAAE;IAClB,IAAA,qBAAW,GAAE;8BACA,IAAI;iDAAC;AAMb;IAHL,IAAA,mBAAS,GAAE;IACX,IAAA,qBAAW,GAAE;IACb,IAAA,qBAAW,GAAE;;;;8CAKb;AAzDQ,YAAY;IADxB,IAAA,gBAAM,GAAE;GACI,YAAY,CA0DxB;AA1DY,oCAAY"}
1
+ {"version":3,"file":"organisation.entity.js","sourceRoot":"","sources":["../../../src/organisation/entities/organisation.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA4C;AAE5C,qCAaiB;AACjB,qFAAwE;AAGjE,IAAM,YAAY,GAAlB,MAAM,YAAY;IAoCrB,4DAA4D;IAItD,AAAN,KAAK,CAAC,UAAU;QACZ,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YACnB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;SACzB;IACL,CAAC;CACJ,CAAA;AA5CG;IAAC,IAAA,gCAAsB,GAAE;IACxB,IAAA,qBAAW,GAAE;;wCACF;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;;0CACO;AAErB;IAAC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,uDAAsB,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,YAAY,EAAE;QAC9D,KAAK,EAAE,IAAI;QACX,OAAO,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;KAChC,CAAC;IACD,IAAA,eAAK,GAAE;;iDAC+B;AAEvC;IAAC,IAAA,gBAAM,GAAE;IACR,IAAA,qBAAW,GAAE;;0CACA;AAEd;IAAC,IAAA,0BAAgB,GAAE;IAClB,IAAA,qBAAW,GAAE;8BACA,IAAI;iDAAC;AAEnB;IAAC,IAAA,0BAAgB,GAAE;IAClB,IAAA,qBAAW,GAAE;8BACD,IAAI;gDAAC;AAElB;IAAC,IAAA,0BAAgB,GAAE;IAClB,IAAA,qBAAW,GAAE;8BACA,IAAI;iDAAC;AAMb;IAHL,IAAA,mBAAS,GAAE;IACX,IAAA,qBAAW,GAAE;IACb,IAAA,qBAAW,GAAE;;;;8CAKb;AA5CQ,YAAY;IADxB,IAAA,gBAAM,GAAE;GACI,YAAY,CA6CxB;AA7CY,oCAAY"}
@@ -16,38 +16,94 @@ exports.OrganisationService = void 0;
16
16
  const common_1 = require("@nestjs/common");
17
17
  const typeorm_1 = require("@nestjs/typeorm");
18
18
  const typeorm_2 = require("typeorm");
19
+ const RolesEnum_1 = require("./dto/RolesEnum");
20
+ const member_role_entity_1 = require("./entities/member-role.entity");
21
+ const organisation_membership_entity_1 = require("./entities/organisation-membership.entity");
19
22
  const organisation_entity_1 = require("./entities/organisation.entity");
20
23
  let OrganisationService = class OrganisationService {
21
24
  constructor(repository) {
22
25
  this.repository = repository;
23
26
  }
24
27
  async create(createOrganisationDto) {
25
- return this.repository.save(createOrganisationDto);
28
+ // create a new organisation
29
+ const unsavedOrganisation = new organisation_entity_1.Organisation();
30
+ unsavedOrganisation.name = createOrganisationDto.name;
31
+ unsavedOrganisation.memberships = [];
32
+ // add the owner
33
+ const ownerMembership = new organisation_membership_entity_1.OrganisationMembership();
34
+ ownerMembership.person = createOrganisationDto.owner;
35
+ const ownerRole = new member_role_entity_1.MembershipRole();
36
+ ownerRole.name = RolesEnum_1.Roles.owner;
37
+ ownerMembership.roles.push(ownerRole);
38
+ unsavedOrganisation.memberships.push(ownerMembership);
39
+ // add all the others
40
+ const normalMemberships = createOrganisationDto.members.map((member) => {
41
+ const membership = new organisation_membership_entity_1.OrganisationMembership();
42
+ membership.person = member;
43
+ const memberRole = new member_role_entity_1.MembershipRole();
44
+ memberRole.name = RolesEnum_1.Roles.member;
45
+ membership.roles.push(memberRole);
46
+ return membership;
47
+ });
48
+ unsavedOrganisation.memberships.push(...normalMemberships);
49
+ return this.repository.save(unsavedOrganisation);
26
50
  }
27
51
  async findAllForUser(currentUserId) {
28
- return this.repository
29
- .createQueryBuilder("orgs")
30
- .innerJoinAndSelect("orgs.owner", "owner")
31
- .where("owner.id = :currentUserId")
32
- .setParameters({ currentUserId })
33
- .getMany();
52
+ return this.repository.find({
53
+ where: {
54
+ memberships: {
55
+ person: {
56
+ id: currentUserId,
57
+ },
58
+ },
59
+ },
60
+ });
34
61
  }
35
62
  async findOne(uuid, currentUserId) {
36
- return this.repository
37
- .createQueryBuilder("orgs")
38
- .innerJoinAndSelect("orgs.owner", "owner")
39
- .where("owner.id = :currentUserId")
40
- .andWhere("orgs.uuid = :uuid")
41
- .setParameters({ currentUserId, uuid })
42
- .getOneOrFail();
63
+ return this.repository.findOneOrFail({
64
+ where: {
65
+ uuid,
66
+ memberships: {
67
+ person: {
68
+ id: currentUserId,
69
+ },
70
+ },
71
+ },
72
+ });
43
73
  }
44
74
  async update(uuid, updateOrganisationDto, currentUserId) {
45
- return this.repository.update({ uuid, ownerId: currentUserId }, updateOrganisationDto);
75
+ const ownerOfOrg = await this.repository.findOneOrFail({
76
+ where: {
77
+ uuid,
78
+ memberships: {
79
+ person: {
80
+ id: currentUserId,
81
+ },
82
+ roles: {
83
+ name: RolesEnum_1.Roles.owner,
84
+ },
85
+ },
86
+ },
87
+ });
88
+ this.repository.merge(ownerOfOrg, updateOrganisationDto);
89
+ return this.repository.update(ownerOfOrg.id, ownerOfOrg);
46
90
  }
47
91
  async remove(uuid, currentUserId) {
92
+ const ownerOfOrg = await this.repository.findOneOrFail({
93
+ where: {
94
+ uuid,
95
+ memberships: {
96
+ person: {
97
+ id: currentUserId,
98
+ },
99
+ roles: {
100
+ name: RolesEnum_1.Roles.owner,
101
+ },
102
+ },
103
+ },
104
+ });
48
105
  return this.repository.delete({
49
- uuid,
50
- ownerId: currentUserId,
106
+ id: ownerOfOrg.id,
51
107
  });
52
108
  }
53
109
  };
@@ -1 +1 @@
1
- {"version":3,"file":"organisation.service.js","sourceRoot":"","sources":["../../src/organisation/organisation.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA0C;AAC1C,6CAAiD;AACjD,qCAA+D;AAG/D,wEAA4D;AAGrD,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAC5B,YAEY,UAAoC;QAApC,eAAU,GAAV,UAAU,CAA0B;IAC7C,CAAC;IAEJ,KAAK,CAAC,MAAM,CACR,qBAA4C;QAE5C,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;IACvD,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,aAAqB;QACtC,OAAO,IAAI,CAAC,UAAU;aACjB,kBAAkB,CAAC,MAAM,CAAC;aAC1B,kBAAkB,CAAC,YAAY,EAAE,OAAO,CAAC;aACzC,KAAK,CAAC,2BAA2B,CAAC;aAClC,aAAa,CAAC,EAAC,aAAa,EAAC,CAAC;aAC9B,OAAO,EAAE,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,IAAY,EAAE,aAAqB;QAC7C,OAAO,IAAI,CAAC,UAAU;aACjB,kBAAkB,CAAC,MAAM,CAAC;aAC1B,kBAAkB,CAAC,YAAY,EAAE,OAAO,CAAC;aACzC,KAAK,CAAC,2BAA2B,CAAC;aAClC,QAAQ,CAAC,mBAAmB,CAAC;aAC7B,aAAa,CAAC,EAAC,aAAa,EAAE,IAAI,EAAC,CAAC;aACpC,YAAY,EAAE,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,MAAM,CACR,IAAY,EACZ,qBAA4C,EAC5C,aAAqB;QAErB,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CACzB,EAAC,IAAI,EAAE,OAAO,EAAE,aAAa,EAAC,EAC9B,qBAAqB,CACxB,CAAC;IACN,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAY,EAAE,aAAqB;QAC5C,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;YAC1B,IAAI;YACJ,OAAO,EAAE,aAAa;SACzB,CAAC,CAAC;IACP,CAAC;CACJ,CAAA;AAhDY,mBAAmB;IAD/B,IAAA,mBAAU,GAAE;IAGJ,WAAA,IAAA,0BAAgB,EAAC,kCAAY,CAAC,CAAA;qCACX,oBAAU;GAHzB,mBAAmB,CAgD/B;AAhDY,kDAAmB"}
1
+ {"version":3,"file":"organisation.service.js","sourceRoot":"","sources":["../../src/organisation/organisation.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA0C;AAC1C,6CAAiD;AACjD,qCAA+D;AAE/D,+CAAsC;AAEtC,sEAA6D;AAC7D,8FAAiF;AACjF,wEAA4D;AAGr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J;aACJ;SACJ,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;YAC1B,EAAE,EAAE,UAAU,CAAC,EAAE;SACpB,CAAC,CAAC;IACP,CAAC;CACJ,CAAA;AA1GY,mBAAmB;IAD/B,IAAA,mBAAU,GAAE;IAGJ,WAAA,IAAA,0BAAgB,EAAC,kCAAY,CAAC,CAAA;qCACX,oBAAU;GAHzB,mBAAmB,CA0G/B;AA1GY,kDAAmB"}
@@ -1,4 +1,4 @@
1
- import { Organisation } from "../../organisation/entities/organisation.entity";
1
+ import { OrganisationMembership } from "../../organisation/entities/organisation-membership.entity";
2
2
  export declare class Person {
3
3
  id: number;
4
4
  email: string;
@@ -11,8 +11,7 @@ export declare class Person {
11
11
  picture: string;
12
12
  auth0UserId: string;
13
13
  username?: string;
14
- memberOfOrganisations: Organisation[];
15
- ownerOfOrganisations: Organisation[];
14
+ memberships: OrganisationMembership[];
16
15
  createdDate: Date;
17
16
  updateDate: Date;
18
17
  deletedDate: Date;