grm-shared-library 1.0.44 → 1.0.46

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/index.d.ts CHANGED
@@ -6,7 +6,6 @@ export * from './modules/common/index';
6
6
  export * from './modules/permission/index';
7
7
  export * from './modules/role/index';
8
8
  export * from './modules/user/index';
9
- export * from './modules/partner/index';
10
9
  export * from './modules/control-centre/index';
11
10
  /**
12
11
  * Kafka
package/dist/index.js CHANGED
@@ -22,7 +22,6 @@ __exportStar(require("./modules/common/index"), exports);
22
22
  __exportStar(require("./modules/permission/index"), exports);
23
23
  __exportStar(require("./modules/role/index"), exports);
24
24
  __exportStar(require("./modules/user/index"), exports);
25
- __exportStar(require("./modules/partner/index"), exports);
26
25
  __exportStar(require("./modules/control-centre/index"), exports);
27
26
  /**
28
27
  * Kafka
@@ -10,4 +10,5 @@ export declare class CreateControlCentreDto {
10
10
  logo?: string;
11
11
  contactPerson: ContactPersonDto;
12
12
  attributes?: Record<string, any>;
13
+ organizationId?: number;
13
14
  }
@@ -33,6 +33,7 @@ __decorate([
33
33
  __decorate([
34
34
  (0, class_validator_1.IsEmail)(),
35
35
  (0, class_validator_1.IsOptional)(),
36
+ (0, class_validator_1.MaxLength)(50),
36
37
  __metadata("design:type", String)
37
38
  ], CreateControlCentreDto.prototype, "email", void 0);
38
39
  __decorate([
@@ -60,3 +61,7 @@ __decorate([
60
61
  (0, class_validator_1.IsOptional)(),
61
62
  __metadata("design:type", Object)
62
63
  ], CreateControlCentreDto.prototype, "attributes", void 0);
64
+ __decorate([
65
+ (0, class_validator_1.IsNumber)(),
66
+ __metadata("design:type", Number)
67
+ ], CreateControlCentreDto.prototype, "organizationId", void 0);
@@ -1,5 +1,6 @@
1
1
  import { MapAddressDto } from "../../common";
2
2
  import { ContactPersonDto } from "../../common/dtos/contact-person.dto";
3
+ import { Organization } from "../../organization";
3
4
  export interface ControlCentre {
4
5
  id?: number;
5
6
  name: string;
@@ -10,6 +11,7 @@ export interface ControlCentre {
10
11
  logo?: string;
11
12
  contactPerson: ContactPersonDto;
12
13
  attributes?: Record<string, any>;
14
+ organization: Organization;
13
15
  createdAt?: Date;
14
16
  updatedAt?: Date;
15
17
  }
@@ -12,5 +12,4 @@ export declare class CreateOrganizationDto {
12
12
  logo?: string;
13
13
  contactPerson: ContactPersonDto;
14
14
  controlCentreIds?: number[];
15
- partnerIds?: number[];
16
15
  }
@@ -78,7 +78,3 @@ __decorate([
78
78
  (0, class_validator_1.IsOptional)(),
79
79
  __metadata("design:type", Array)
80
80
  ], CreateOrganizationDto.prototype, "controlCentreIds", void 0);
81
- __decorate([
82
- (0, class_validator_1.IsNumber)({}, { each: true }),
83
- __metadata("design:type", Array)
84
- ], CreateOrganizationDto.prototype, "partnerIds", void 0);
@@ -1,7 +1,6 @@
1
1
  import { ContactPersonDto } from "../../common/dtos/contact-person.dto";
2
2
  import { MapAddressDto } from "../../common/dtos/map-address.dto";
3
3
  import { ControlCentre } from "../../control-centre";
4
- import { Partner } from "../../partner";
5
4
  export interface Organization {
6
5
  id?: number;
7
6
  name: string;
@@ -15,7 +14,6 @@ export interface Organization {
15
14
  logo?: string;
16
15
  contactPerson: ContactPersonDto;
17
16
  controlCentres?: ControlCentre[];
18
- partners?: Partner[];
19
17
  createdAt?: Date;
20
18
  updatedAt?: Date;
21
19
  }
@@ -16,10 +16,10 @@ exports.PERMISSIONS_DATA = [
16
16
  {
17
17
  module: permissions_moudule_enum_1.PermissionsModule.PARTNER,
18
18
  actions: [
19
- permission_actions_enum_1.PermissionActions.CREATE_PARTNER,
20
- permission_actions_enum_1.PermissionActions.READ_PARTNER,
21
- permission_actions_enum_1.PermissionActions.UPDATE_PARTNER,
22
- permission_actions_enum_1.PermissionActions.DELETE_PARTNER
19
+ permission_actions_enum_1.PermissionActions.CREATE_CONTROL_CENTRE,
20
+ permission_actions_enum_1.PermissionActions.READ_CONTROL_CENTRE,
21
+ permission_actions_enum_1.PermissionActions.UPDATE_CONTROL_CENTRE,
22
+ permission_actions_enum_1.PermissionActions.DELETE_CONTROL_CENTRE
23
23
  ]
24
24
  },
25
25
  {
@@ -1,22 +1,22 @@
1
1
  export declare enum PermissionActions {
2
- CREATE_ORGANIZATION = "create-organization",
3
- READ_ORGANIZATION = "read-organization",
4
- UPDATE_ORGANIZATION = "update-organization",
5
- DELETE_ORGANIZATION = "delete-organization",
6
- CREATE_PARTNER = "create-partner",
7
- READ_PARTNER = "read-partner",
8
- UPDATE_PARTNER = "update-partner",
9
- DELETE_PARTNER = "delete-partner",
10
- CREATE_USER = "create-user",
11
- READ_USER = "read-user",
12
- UPDATE_USER = "update-user",
13
- DELETE_USER = "delete-user",
14
- CREATE_ROLE = "create-role",
15
- READ_ROLE = "read-role",
16
- UPDATE_ROLE = "update-role",
17
- DELETE_ROLE = "delete-role",
18
- CREATE_INCIDENT = "create-incident",
19
- READ_INCIDENT = "read-incident",
20
- UPDATE_INCIDENT = "update-incident",
21
- DELETE_INCIDENT = "delete-incident"
2
+ CREATE_ORGANIZATION = "create:organization",
3
+ READ_ORGANIZATION = "read:organization",
4
+ UPDATE_ORGANIZATION = "update:organization",
5
+ DELETE_ORGANIZATION = "delete:organization",
6
+ CREATE_CONTROL_CENTRE = "create:control-centre",
7
+ READ_CONTROL_CENTRE = "read:control-centre",
8
+ UPDATE_CONTROL_CENTRE = "update:control-centre",
9
+ DELETE_CONTROL_CENTRE = "delete:control-centre",
10
+ CREATE_ROLE = "create:role",
11
+ READ_ROLE = "read:role",
12
+ UPDATE_ROLE = "update:role",
13
+ DELETE_ROLE = "delete:role",
14
+ CREATE_USER = "create:user",
15
+ READ_USER = "read:user",
16
+ UPDATE_USER = "update:user",
17
+ DELETE_USER = "delete:user",
18
+ CREATE_INCIDENT = "create:incident",
19
+ READ_INCIDENT = "read:incident",
20
+ UPDATE_INCIDENT = "update:incident",
21
+ DELETE_INCIDENT = "delete:incident"
22
22
  }
@@ -3,29 +3,29 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PermissionActions = void 0;
4
4
  var PermissionActions;
5
5
  (function (PermissionActions) {
6
- //Module: Organization
7
- PermissionActions["CREATE_ORGANIZATION"] = "create-organization";
8
- PermissionActions["READ_ORGANIZATION"] = "read-organization";
9
- PermissionActions["UPDATE_ORGANIZATION"] = "update-organization";
10
- PermissionActions["DELETE_ORGANIZATION"] = "delete-organization";
11
- //Module: Partner
12
- PermissionActions["CREATE_PARTNER"] = "create-partner";
13
- PermissionActions["READ_PARTNER"] = "read-partner";
14
- PermissionActions["UPDATE_PARTNER"] = "update-partner";
15
- PermissionActions["DELETE_PARTNER"] = "delete-partner";
16
- //Module: User
17
- PermissionActions["CREATE_USER"] = "create-user";
18
- PermissionActions["READ_USER"] = "read-user";
19
- PermissionActions["UPDATE_USER"] = "update-user";
20
- PermissionActions["DELETE_USER"] = "delete-user";
21
- //Module: Role
22
- PermissionActions["CREATE_ROLE"] = "create-role";
23
- PermissionActions["READ_ROLE"] = "read-role";
24
- PermissionActions["UPDATE_ROLE"] = "update-role";
25
- PermissionActions["DELETE_ROLE"] = "delete-role";
26
- //Module: Incident
27
- PermissionActions["CREATE_INCIDENT"] = "create-incident";
28
- PermissionActions["READ_INCIDENT"] = "read-incident";
29
- PermissionActions["UPDATE_INCIDENT"] = "update-incident";
30
- PermissionActions["DELETE_INCIDENT"] = "delete-incident";
6
+ // Module: Organization
7
+ PermissionActions["CREATE_ORGANIZATION"] = "create:organization";
8
+ PermissionActions["READ_ORGANIZATION"] = "read:organization";
9
+ PermissionActions["UPDATE_ORGANIZATION"] = "update:organization";
10
+ PermissionActions["DELETE_ORGANIZATION"] = "delete:organization";
11
+ // Module: ControlCentre
12
+ PermissionActions["CREATE_CONTROL_CENTRE"] = "create:control-centre";
13
+ PermissionActions["READ_CONTROL_CENTRE"] = "read:control-centre";
14
+ PermissionActions["UPDATE_CONTROL_CENTRE"] = "update:control-centre";
15
+ PermissionActions["DELETE_CONTROL_CENTRE"] = "delete:control-centre";
16
+ // Module: Role
17
+ PermissionActions["CREATE_ROLE"] = "create:role";
18
+ PermissionActions["READ_ROLE"] = "read:role";
19
+ PermissionActions["UPDATE_ROLE"] = "update:role";
20
+ PermissionActions["DELETE_ROLE"] = "delete:role";
21
+ // Module: User
22
+ PermissionActions["CREATE_USER"] = "create:user";
23
+ PermissionActions["READ_USER"] = "read:user";
24
+ PermissionActions["UPDATE_USER"] = "update:user";
25
+ PermissionActions["DELETE_USER"] = "delete:user";
26
+ // Module: Incident
27
+ PermissionActions["CREATE_INCIDENT"] = "create:incident";
28
+ PermissionActions["READ_INCIDENT"] = "read:incident";
29
+ PermissionActions["UPDATE_INCIDENT"] = "update:incident";
30
+ PermissionActions["DELETE_INCIDENT"] = "delete:incident";
31
31
  })(PermissionActions || (exports.PermissionActions = PermissionActions = {}));
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ROLES_DATA = void 0;
4
+ const permission_1 = require("../../permission");
4
5
  const role_enum_1 = require("../enums/role.enum");
5
6
  exports.ROLES_DATA = [
6
7
  {
@@ -9,69 +10,84 @@ exports.ROLES_DATA = [
9
10
  permissions: ['*']
10
11
  },
11
12
  {
12
- name: role_enum_1.Roles.ADMIN,
13
- description: 'Organization Admin',
13
+ name: role_enum_1.Roles.ORGANIZATION_ADMIN,
14
+ description: 'Organization Admin: Manage Organization & Set up Control Centres',
14
15
  permissions: [
15
- 'create-organization',
16
- 'read-organization',
17
- 'update-organization',
18
- 'create-partner',
19
- 'read-partner',
20
- 'update-partner',
21
- 'delete-partner',
22
- 'create-user',
23
- 'read-user',
24
- 'update-user',
25
- 'delete-user',
26
- 'read-role',
27
- 'create-incident',
28
- 'read-incident',
29
- 'update-incident',
30
- 'delete-incident'
16
+ //organization
17
+ permission_1.PermissionActions.READ_ORGANIZATION,
18
+ permission_1.PermissionActions.UPDATE_ORGANIZATION,
19
+ //control centre
20
+ permission_1.PermissionActions.CREATE_CONTROL_CENTRE,
21
+ permission_1.PermissionActions.READ_CONTROL_CENTRE,
22
+ permission_1.PermissionActions.UPDATE_CONTROL_CENTRE,
23
+ permission_1.PermissionActions.DELETE_CONTROL_CENTRE,
24
+ //Role
25
+ permission_1.PermissionActions.READ_ROLE,
26
+ //User
27
+ permission_1.PermissionActions.CREATE_USER,
28
+ permission_1.PermissionActions.READ_USER,
29
+ permission_1.PermissionActions.UPDATE_USER,
30
+ permission_1.PermissionActions.DELETE_USER,
31
+ //Incident
32
+ permission_1.PermissionActions.CREATE_INCIDENT,
33
+ permission_1.PermissionActions.READ_INCIDENT,
34
+ permission_1.PermissionActions.UPDATE_INCIDENT
31
35
  ]
32
36
  },
33
37
  {
34
- name: role_enum_1.Roles.USER,
35
- description: 'Organization User',
38
+ name: role_enum_1.Roles.ORGANIZATION_USER,
39
+ description: 'Organization User: View organization-wide data',
36
40
  permissions: [
37
- 'read-organization',
38
- 'read-partner',
39
- 'read-user',
40
- 'read-role',
41
- 'create-incident',
42
- 'read-incident',
43
- 'update-incident'
41
+ //organization
42
+ permission_1.PermissionActions.READ_ORGANIZATION,
43
+ //control centre
44
+ permission_1.PermissionActions.READ_CONTROL_CENTRE,
45
+ //Role
46
+ permission_1.PermissionActions.READ_ROLE,
47
+ //User
48
+ permission_1.PermissionActions.READ_USER,
49
+ //Incident
50
+ permission_1.PermissionActions.READ_INCIDENT
44
51
  ]
45
52
  },
46
53
  {
47
- name: role_enum_1.Roles.PARTNER_ADMIN,
48
- description: 'Partner Admin',
54
+ name: role_enum_1.Roles.CONTROL_CENTRE_ADMIN,
55
+ description: 'Control Centre Admin: Manage Control Centre',
49
56
  permissions: [
50
- 'read-organization',
51
- 'read-partner',
52
- 'update-partner',
53
- 'create-user',
54
- 'read-user',
55
- 'update-user',
56
- 'delete-user',
57
- 'read-role',
58
- 'create-incident',
59
- 'read-incident',
60
- 'update-incident',
61
- 'delete-incident'
57
+ //Organization
58
+ permission_1.PermissionActions.READ_ORGANIZATION,
59
+ //Control Centre
60
+ permission_1.PermissionActions.READ_CONTROL_CENTRE,
61
+ permission_1.PermissionActions.UPDATE_CONTROL_CENTRE,
62
+ //Role
63
+ permission_1.PermissionActions.READ_ROLE,
64
+ //User
65
+ permission_1.PermissionActions.CREATE_USER,
66
+ permission_1.PermissionActions.READ_USER,
67
+ permission_1.PermissionActions.UPDATE_USER,
68
+ permission_1.PermissionActions.DELETE_USER,
69
+ //Incident
70
+ permission_1.PermissionActions.CREATE_INCIDENT,
71
+ permission_1.PermissionActions.READ_INCIDENT,
72
+ permission_1.PermissionActions.UPDATE_INCIDENT
62
73
  ]
63
74
  },
64
75
  {
65
- name: role_enum_1.Roles.PARTNER_USER,
66
- description: 'Partner User',
76
+ name: role_enum_1.Roles.CONTROL_CENTRE_USER,
77
+ description: 'Control Centre User: View control centre-wide data & Manage Incidents',
67
78
  permissions: [
68
- 'read-organization',
69
- 'read-partner',
70
- 'read-user',
71
- 'read-role',
72
- 'create-incident',
73
- 'read-incident',
74
- 'update-incident'
79
+ //Organization
80
+ permission_1.PermissionActions.READ_ORGANIZATION,
81
+ //Control Centre
82
+ permission_1.PermissionActions.READ_CONTROL_CENTRE,
83
+ //Role
84
+ permission_1.PermissionActions.READ_ROLE,
85
+ //User
86
+ permission_1.PermissionActions.READ_USER,
87
+ //Incident
88
+ permission_1.PermissionActions.CREATE_INCIDENT,
89
+ permission_1.PermissionActions.READ_INCIDENT,
90
+ permission_1.PermissionActions.UPDATE_INCIDENT
75
91
  ]
76
92
  }
77
93
  ];
@@ -1,7 +1,7 @@
1
1
  export declare enum Roles {
2
- SUPER_ADMIN = "SUPER_ADMIN",
3
- ADMIN = "ADMIN",
4
- USER = "USER",
5
- PARTNER_ADMIN = "PARTNER_ADMIN",
6
- PARTNER_USER = "PARTNER_USER"
2
+ SUPER_ADMIN = "Super Admin",
3
+ ORGANIZATION_ADMIN = "Org:Admin",
4
+ ORGANIZATION_USER = "Org:User",
5
+ CONTROL_CENTRE_ADMIN = "Control-Centre:Admin",
6
+ CONTROL_CENTRE_USER = "Control-Centre:User"
7
7
  }
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Roles = void 0;
4
4
  var Roles;
5
5
  (function (Roles) {
6
- Roles["SUPER_ADMIN"] = "SUPER_ADMIN";
7
- Roles["ADMIN"] = "ADMIN";
8
- Roles["USER"] = "USER";
9
- Roles["PARTNER_ADMIN"] = "PARTNER_ADMIN";
10
- Roles["PARTNER_USER"] = "PARTNER_USER";
6
+ Roles["SUPER_ADMIN"] = "Super Admin";
7
+ Roles["ORGANIZATION_ADMIN"] = "Org:Admin";
8
+ Roles["ORGANIZATION_USER"] = "Org:User";
9
+ Roles["CONTROL_CENTRE_ADMIN"] = "Control-Centre:Admin";
10
+ Roles["CONTROL_CENTRE_USER"] = "Control-Centre:User";
11
11
  })(Roles || (exports.Roles = Roles = {}));
@@ -10,6 +10,6 @@ export declare class CreateUserDto {
10
10
  status?: UserStatus;
11
11
  isTermsAccepted: boolean;
12
12
  otp?: string;
13
- partnerId?: number;
13
+ controlCentreId?: number;
14
14
  organizationId: number;
15
15
  }
@@ -81,7 +81,7 @@ __decorate([
81
81
  (0, class_validator_1.IsNumber)(),
82
82
  (0, class_validator_1.IsOptional)(),
83
83
  __metadata("design:type", Number)
84
- ], CreateUserDto.prototype, "partnerId", void 0);
84
+ ], CreateUserDto.prototype, "controlCentreId", void 0);
85
85
  __decorate([
86
86
  (0, class_validator_1.IsNumber)(),
87
87
  (0, class_validator_1.IsNotEmpty)(),
@@ -1,5 +1,5 @@
1
+ import { ControlCentre } from "../../control-centre";
1
2
  import { Organization } from "../../organization";
2
- import { Partner } from "../../partner/interfaces/partner";
3
3
  import { Role } from "../../role";
4
4
  export interface User {
5
5
  id?: number;
@@ -15,7 +15,7 @@ export interface User {
15
15
  isEmailVerified?: boolean;
16
16
  otp?: string;
17
17
  otpExpiresAt?: Date;
18
- partner?: Partner;
18
+ controlCentre?: ControlCentre;
19
19
  organization: Organization;
20
20
  createdAt?: Date;
21
21
  updatedAt?: Date;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grm-shared-library",
3
- "version": "1.0.44",
3
+ "version": "1.0.46",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [