@dative-gpi/foundation-shared-domain 1.0.159-notification → 1.0.159-notificationv3

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,6 @@
1
1
  import { type MessageType } from "../../enums/messages";
2
2
  import { isoToEpoch } from "../../tools/datesTools";
3
- import { Scope } from "../../enums/applications";
4
- import { Criticity } from "../../enums/alerts";
3
+ import type { Criticity } from "../../enums/alerts";
5
4
  import { NotificationAudience } from "./notificationAudience";
6
5
 
7
6
  export class NotificationInfos {
@@ -31,50 +30,6 @@ export class NotificationInfos {
31
30
  this.acknowledgingTimestamp = params.acknowledgingTimestamp ?
32
31
  isoToEpoch(params.acknowledgingTimestamp) : null;
33
32
  }
34
-
35
- static getFromAudience = (
36
- notifications: NotificationInfos[],
37
- application: boolean,
38
- criticity: Criticity,
39
- organisationId?: string | null,
40
- userId?: string | null
41
- ): NotificationInfos[] => notifications.filter((n: NotificationInfos) => {
42
- if (n.acknowledged) {
43
- return false;
44
- }
45
- if (![Criticity.None, n.criticity].includes(criticity)) {
46
- return false;
47
- }
48
-
49
- return n.audiences.some(a => {
50
- switch (a.targetScope) {
51
- case Scope.OrganisationType:
52
- case Scope.Organisation:
53
- case Scope.UserOrganisation:
54
- return Boolean(organisationId && n.organisationId && n.organisationId === organisationId);
55
- case Scope.User:
56
- return Boolean(userId && a.targetId === userId);
57
- case Scope.Application:
58
- case Scope.Public:
59
- return Boolean(application);
60
- default:
61
- return false;
62
- }
63
- });
64
- });
65
-
66
- static getForDrawer = (
67
- notifications: NotificationInfos[],
68
- organisationId: string,
69
- userId: string,
70
- criticity: Criticity = Criticity.None
71
- ): NotificationInfos[] => NotificationInfos.getFromAudience(notifications, true, criticity, organisationId, userId);
72
-
73
- static getForCard = (
74
- notifications: NotificationInfos[],
75
- organisationId: string,
76
- criticity: Criticity = Criticity.None
77
- ): NotificationInfos[] => NotificationInfos.getFromAudience(notifications, false, criticity, organisationId, null);
78
33
  }
79
34
 
80
35
  export interface NotificationInfosDTO {
@@ -6,21 +6,19 @@ import type { DashboardType } from "../../enums/dashboards";
6
6
 
7
7
  export class OrganisationDetails extends OrganisationInfos {
8
8
  code: string;
9
- organisationTypeId: string;
10
9
  mainDashboardId: string | null;
11
10
  mainDashboardType: DashboardType;
12
11
  description: string;
13
12
  locationsCount: number;
14
13
  groupsCount: number;
15
14
  deviceOrganisationsCount: number;
16
- alertsCount : number;
15
+ alertsCount: number;
17
16
  permissions: PermissionInfos[];
18
17
 
19
18
  constructor(params: OrganisationDetailsDTO) {
20
19
  super(params);
21
20
 
22
21
  this.code = params.code;
23
- this.organisationTypeId = params.organisationTypeId;
24
22
  this.mainDashboardType = params.mainDashboardType;
25
23
  this.mainDashboardId = params.mainDashboardId;
26
24
  this.description = params.description;
@@ -34,14 +32,13 @@ export class OrganisationDetails extends OrganisationInfos {
34
32
 
35
33
  export interface OrganisationDetailsDTO extends OrganisationInfosDTO {
36
34
  code: string;
37
- organisationTypeId: string;
38
35
  mainDashboardId: string | null;
39
36
  mainDashboardType: DashboardType;
40
37
  description: string;
41
38
  locationsCount: number;
42
39
  groupsCount: number;
43
40
  deviceOrganisationsCount: number;
44
- alertsCount : number;
41
+ alertsCount: number;
45
42
  permissions: PermissionInfosDTO[];
46
43
  }
47
44
 
@@ -1,5 +1,6 @@
1
1
  export class OrganisationInfos {
2
2
  id: string;
3
+ organisationTypeId: string;
3
4
  imageId: string | null;
4
5
  label: string;
5
6
  userOrganisationsCount: number;
@@ -8,6 +9,7 @@ export class OrganisationInfos {
8
9
 
9
10
  constructor(params: OrganisationInfosDTO) {
10
11
  this.id = params.id;
12
+ this.organisationTypeId = params.organisationTypeId;
11
13
  this.imageId = params.imageId;
12
14
  this.label = params.label;
13
15
  this.userOrganisationsCount = params.userOrganisationsCount;
@@ -18,6 +20,7 @@ export class OrganisationInfos {
18
20
 
19
21
  export interface OrganisationInfosDTO {
20
22
  id: string;
23
+ organisationTypeId: string;
21
24
  imageId: string | null;
22
25
  label: string;
23
26
  userOrganisationsCount: number;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dative-gpi/foundation-shared-domain",
3
3
  "sideEffects": false,
4
- "version": "1.0.159-notification",
4
+ "version": "1.0.159-notificationv3",
5
5
  "description": "",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -12,5 +12,5 @@
12
12
  "peerDependencies": {
13
13
  "date-fns": "^3.6.0"
14
14
  },
15
- "gitHead": "bd9f45c4be8554c7778b5388f3d60d25c9244054"
15
+ "gitHead": "eabdcfc7aa0058b0192d9d8993ee99cefabf458e"
16
16
  }