@dative-gpi/foundation-shared-domain 1.0.57 → 1.0.58-groupings
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/enums/dashboards.ts +2 -1
- package/enums/dates.ts +6 -0
- package/enums/deviceExplorerElements.ts +5 -0
- package/enums/index.ts +3 -0
- package/enums/reports.ts +5 -0
- package/enums/widgetTemplates.ts +5 -0
- package/models/authTokens/authTokenInfos.ts +1 -1
- package/models/images/imageDetails.ts +0 -1
- package/models/index.ts +4 -2
- package/models/legalInformations/index.ts +2 -0
- package/models/legalInformations/legalInformationDetails.ts +10 -0
- package/models/legalInformations/legalInformationInfos.ts +17 -0
- package/models/locations/index.ts +0 -1
- package/models/notifications/notificationInfos.ts +41 -2
- package/models/terminals/terminalInfos.ts +1 -1
- package/models/userLegalInformations/index.ts +2 -0
- package/models/userLegalInformations/userLegalInformationDetails.ts +14 -0
- package/models/userLegalInformations/userLegalInformationInfos.ts +17 -0
- package/package.json +2 -2
- package/tools/datesTools.ts +10 -0
- package/tools/enumTools.ts +5 -0
- package/tools/index.ts +3 -2
- package/models/locations/area.ts +0 -7
- package/tools/notificationsTools.ts +0 -39
package/enums/dashboards.ts
CHANGED
package/enums/dates.ts
CHANGED
package/enums/index.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from "./customProperties";
|
|
|
8
8
|
export * from "./dashboards";
|
|
9
9
|
export * from "./datas";
|
|
10
10
|
export * from "./dates";
|
|
11
|
+
export * from "./deviceExplorerElements";
|
|
11
12
|
export * from "./filters";
|
|
12
13
|
export * from "./index";
|
|
13
14
|
export * from "./lists";
|
|
@@ -15,3 +16,5 @@ export * from "./messages";
|
|
|
15
16
|
export * from "./roles";
|
|
16
17
|
export * from "./times";
|
|
17
18
|
export * from "./users";
|
|
19
|
+
export * from "./widgetTemplates";
|
|
20
|
+
export * from "./reports";
|
package/enums/reports.ts
ADDED
package/models/index.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
export * from "./applications";
|
|
2
2
|
export * from "./authTokens";
|
|
3
3
|
export * from "./images";
|
|
4
|
-
export * from "./languages";
|
|
4
|
+
export * from "./languages"; // No service
|
|
5
|
+
export * from "./legalInformations";
|
|
5
6
|
export * from "./locations";
|
|
6
7
|
export * from "./notifications";
|
|
7
8
|
export * from "./organisations";
|
|
8
|
-
export * from "./organisationTypes";
|
|
9
|
+
export * from "./organisationTypes"; // No service
|
|
9
10
|
export * from "./permissions";
|
|
10
11
|
export * from "./terminals";
|
|
11
12
|
export * from "./timeZones";
|
|
12
13
|
export * from "./translations";
|
|
14
|
+
export * from "./userLegalInformations";
|
|
13
15
|
export * from "./users";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { LegalInformationInfos, type LegalInformationInfosDTO } from "./legalInformationInfos";
|
|
2
|
+
|
|
3
|
+
export class LegalInformationDetails extends LegalInformationInfos {
|
|
4
|
+
constructor(params: LegalInformationDetailsDTO) {
|
|
5
|
+
super(params);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface LegalInformationDetailsDTO extends LegalInformationInfosDTO {
|
|
10
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export class LegalInformationInfos {
|
|
2
|
+
id: string;
|
|
3
|
+
privacyPolicyId: string;
|
|
4
|
+
generalConditionsId: string;
|
|
5
|
+
|
|
6
|
+
constructor(params: LegalInformationInfosDTO) {
|
|
7
|
+
this.id = params.id;
|
|
8
|
+
this.privacyPolicyId = params.privacyPolicyId;
|
|
9
|
+
this.generalConditionsId = params.generalConditionsId;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface LegalInformationInfosDTO {
|
|
14
|
+
id: string;
|
|
15
|
+
privacyPolicyId: string;
|
|
16
|
+
generalConditionsId: string;
|
|
17
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { isoToEpoch } from "
|
|
1
|
+
import { type MessageType } from "../../enums/messages";
|
|
2
|
+
import { isoToEpoch } from "../../tools/datesTools";
|
|
3
|
+
import { Scope } from "../../enums/applications";
|
|
4
|
+
import { Criticity } from "../../enums/alerts";
|
|
3
5
|
|
|
4
6
|
export class NotificationInfos {
|
|
5
7
|
id: string;
|
|
@@ -32,6 +34,43 @@ export class NotificationInfos {
|
|
|
32
34
|
this.acknowledgingTimestamp = params.acknowledgingTimestamp ?
|
|
33
35
|
isoToEpoch(params.acknowledgingTimestamp) : null;
|
|
34
36
|
}
|
|
37
|
+
|
|
38
|
+
static getFromAudience = (
|
|
39
|
+
notifications: NotificationInfos[],
|
|
40
|
+
application: boolean,
|
|
41
|
+
criticity: Criticity,
|
|
42
|
+
organisationId?: string | null,
|
|
43
|
+
userId?: string | null,
|
|
44
|
+
): NotificationInfos[] => notifications.filter((n: NotificationInfos) => {
|
|
45
|
+
if (n.acknowledged) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
if (![Criticity.None, n.criticity].includes(criticity)) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
switch (n.audienceScope) {
|
|
52
|
+
case Scope.Organisation :
|
|
53
|
+
case Scope.UserOrganisation: return organisationId && n.organisationId && n.organisationId === organisationId;
|
|
54
|
+
case Scope.User : return userId && n.audienceId === userId;
|
|
55
|
+
case Scope.Application :
|
|
56
|
+
case Scope.Public : return application;
|
|
57
|
+
|
|
58
|
+
}
|
|
59
|
+
return false;
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
static getForDrawer = (
|
|
63
|
+
notifications: NotificationInfos[],
|
|
64
|
+
organisationId: string,
|
|
65
|
+
userId: string,
|
|
66
|
+
criticity: Criticity = Criticity.None
|
|
67
|
+
): NotificationInfos[] => NotificationInfos.getFromAudience(notifications, true, criticity, organisationId, userId);
|
|
68
|
+
|
|
69
|
+
static getForCard = (
|
|
70
|
+
notifications: NotificationInfos[],
|
|
71
|
+
organisationId: string,
|
|
72
|
+
criticity: Criticity = Criticity.None
|
|
73
|
+
): NotificationInfos[] => NotificationInfos.getFromAudience(notifications, false, criticity, organisationId, null);
|
|
35
74
|
}
|
|
36
75
|
|
|
37
76
|
export interface NotificationInfosDTO {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { UserLegalInformationInfos, type UserLegalInformationInfosDTO } from "./userLegalInformationInfos";
|
|
2
|
+
|
|
3
|
+
export class UserLegalInformationDetails extends UserLegalInformationInfos {
|
|
4
|
+
constructor(params: UserLegalInformationDetailsDTO) {
|
|
5
|
+
super(params);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface UserLegalInformationDetailsDTO extends UserLegalInformationInfosDTO {
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface CreateUserLegalInformationDTO {
|
|
13
|
+
legalInformationId: string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export class UserLegalInformationInfos {
|
|
2
|
+
id: string;
|
|
3
|
+
userId: string;
|
|
4
|
+
legalInformationId: string;
|
|
5
|
+
|
|
6
|
+
constructor(params: UserLegalInformationInfosDTO) {
|
|
7
|
+
this.id = params.id;
|
|
8
|
+
this.userId = params.userId;
|
|
9
|
+
this.legalInformationId = params.legalInformationId;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface UserLegalInformationInfosDTO {
|
|
14
|
+
id: string;
|
|
15
|
+
userId: string;
|
|
16
|
+
legalInformationId: string;
|
|
17
|
+
}
|
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.
|
|
4
|
+
"version": "1.0.58-groupings",
|
|
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": "
|
|
15
|
+
"gitHead": "563e78c4a0b3e8f73fdf8576e9d8bc0b626bc095"
|
|
16
16
|
}
|
package/tools/datesTools.ts
CHANGED
|
@@ -7,6 +7,10 @@ export const OPTIONS: { [key: string]: Intl.DateTimeFormatOptions } = {
|
|
|
7
7
|
day: "2-digit",
|
|
8
8
|
month: "long"
|
|
9
9
|
},
|
|
10
|
+
dayMonthShortOnly: {
|
|
11
|
+
day: "2-digit",
|
|
12
|
+
month: "2-digit"
|
|
13
|
+
},
|
|
10
14
|
shortDate: {
|
|
11
15
|
day: "2-digit",
|
|
12
16
|
month: "2-digit",
|
|
@@ -18,6 +22,12 @@ export const OPTIONS: { [key: string]: Intl.DateTimeFormatOptions } = {
|
|
|
18
22
|
month: "long",
|
|
19
23
|
year: "numeric"
|
|
20
24
|
},
|
|
25
|
+
monthShortTime: {
|
|
26
|
+
day: "2-digit",
|
|
27
|
+
month: "2-digit",
|
|
28
|
+
hour: "2-digit",
|
|
29
|
+
minute: "2-digit"
|
|
30
|
+
},
|
|
21
31
|
shortTime: {
|
|
22
32
|
day: "2-digit",
|
|
23
33
|
month: "2-digit",
|
package/tools/index.ts
CHANGED
package/models/locations/area.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { type NotificationInfos } from "../models";
|
|
2
|
-
import { Criticity, Scope } from "../enums";
|
|
3
|
-
|
|
4
|
-
export const getFromAudience = (
|
|
5
|
-
notifications: NotificationInfos[],
|
|
6
|
-
application: boolean,
|
|
7
|
-
criticity: Criticity,
|
|
8
|
-
organisationId?: string | null,
|
|
9
|
-
userId?: string | null,
|
|
10
|
-
): NotificationInfos[] => notifications.filter((n: NotificationInfos) => {
|
|
11
|
-
if (n.acknowledged) {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
if (![Criticity.None, n.criticity].includes(criticity)) {
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
switch (n.audienceScope) {
|
|
18
|
-
case Scope.Organisation :
|
|
19
|
-
case Scope.UserOrganisation: return organisationId && n.organisationId && n.organisationId === organisationId;
|
|
20
|
-
case Scope.User : return userId && n.audienceId === userId;
|
|
21
|
-
case Scope.Application :
|
|
22
|
-
case Scope.Public : return application;
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
return false;
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
export const getForDrawer = (
|
|
29
|
-
notifications: NotificationInfos[],
|
|
30
|
-
organisationId: string,
|
|
31
|
-
userId: string,
|
|
32
|
-
criticity: Criticity = Criticity.None
|
|
33
|
-
): NotificationInfos[] => getFromAudience(notifications, true, criticity, organisationId, userId);
|
|
34
|
-
|
|
35
|
-
export const getForCard = (
|
|
36
|
-
notifications: NotificationInfos[],
|
|
37
|
-
organisationId: string,
|
|
38
|
-
criticity: Criticity = Criticity.None
|
|
39
|
-
): NotificationInfos[] => getFromAudience(notifications, false, criticity, organisationId, null);
|