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

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.
@@ -37,7 +37,8 @@ export class NotificationInfos {
37
37
  application: boolean,
38
38
  criticity: Criticity,
39
39
  organisationId?: string | null,
40
- userId?: string | null
40
+ userId?: string | null,
41
+ organisationTypeId?: string | null
41
42
  ): NotificationInfos[] => notifications.filter((n: NotificationInfos) => {
42
43
  if (n.acknowledged) {
43
44
  return false;
@@ -49,6 +50,7 @@ export class NotificationInfos {
49
50
  return n.audiences.some(a => {
50
51
  switch (a.targetScope) {
51
52
  case Scope.OrganisationType:
53
+ return Boolean(organisationTypeId && a.targetId === organisationTypeId);
52
54
  case Scope.Organisation:
53
55
  case Scope.UserOrganisation:
54
56
  return Boolean(organisationId && n.organisationId && n.organisationId === organisationId);
@@ -67,14 +69,16 @@ export class NotificationInfos {
67
69
  notifications: NotificationInfos[],
68
70
  organisationId: string,
69
71
  userId: string,
70
- criticity: Criticity = Criticity.None
71
- ): NotificationInfos[] => NotificationInfos.getFromAudience(notifications, true, criticity, organisationId, userId);
72
+ criticity: Criticity = Criticity.None,
73
+ organisationTypeId?: string | null
74
+ ): NotificationInfos[] => NotificationInfos.getFromAudience(notifications, true, criticity, organisationId, userId, organisationTypeId);
72
75
 
73
76
  static getForCard = (
74
77
  notifications: NotificationInfos[],
75
78
  organisationId: string,
76
- criticity: Criticity = Criticity.None
77
- ): NotificationInfos[] => NotificationInfos.getFromAudience(notifications, false, criticity, organisationId, null);
79
+ criticity: Criticity = Criticity.None,
80
+ organisationTypeId?: string | null
81
+ ): NotificationInfos[] => NotificationInfos.getFromAudience(notifications, false, criticity, organisationId, null, organisationTypeId);
78
82
  }
79
83
 
80
84
  export interface NotificationInfosDTO {
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-notificationv2",
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": "b5faf0eec1548f8935f901c421acb2923492991a"
16
16
  }