@spytecgps/nova-orm 1.0.130 → 1.0.132
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/entities/clientAlertConfiguration.d.ts +2 -1
- package/dist/entities/clientAlertConfiguration.js +6 -1
- package/dist/entities/clientAlertConfiguration.js.map +1 -1
- package/dist/entities/userAlertNotificationsConfig.js +3 -0
- package/dist/entities/userAlertNotificationsConfig.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/repositories/clientAlertConfiguration/createClientAlertConfiguration.js +2 -1
- package/dist/repositories/clientAlertConfiguration/createClientAlertConfiguration.js.map +1 -1
- package/dist/repositories/clientAlertConfiguration/setClientAlertRecipients.js +68 -22
- package/dist/repositories/clientAlertConfiguration/setClientAlertRecipients.js.map +1 -1
- package/dist/repositories/clientAlertConfiguration/updateClientAlertConfiguration.js +2 -0
- package/dist/repositories/clientAlertConfiguration/updateClientAlertConfiguration.js.map +1 -1
- package/dist/repositories/userConfigurations/deleteUserAlertNotificationsConfig.d.ts +4 -0
- package/dist/repositories/userConfigurations/deleteUserAlertNotificationsConfig.js +30 -0
- package/dist/repositories/userConfigurations/deleteUserAlertNotificationsConfig.js.map +1 -0
- package/dist/repositories/userConfigurations/getUserAlertNotificationsConfig.d.ts +5 -0
- package/dist/repositories/userConfigurations/getUserAlertNotificationsConfig.js +142 -0
- package/dist/repositories/userConfigurations/getUserAlertNotificationsConfig.js.map +1 -0
- package/dist/repositories/userConfigurations/index.d.ts +5 -2
- package/dist/repositories/userConfigurations/index.js +24 -0
- package/dist/repositories/userConfigurations/index.js.map +1 -1
- package/dist/repositories/userConfigurations/upsertUserAlertNotificationsConfig.d.ts +4 -0
- package/dist/repositories/userConfigurations/upsertUserAlertNotificationsConfig.js +30 -0
- package/dist/repositories/userConfigurations/upsertUserAlertNotificationsConfig.js.map +1 -0
- package/dist/types/clientAlertConfiguration.d.ts +3 -1
- package/dist/types/userConfigurations.d.ts +20 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ClientAlertConfiguration } from '../../entities';
|
|
2
2
|
export const createClientAlertConfiguration = async (novaDataSource, params, logger) => {
|
|
3
|
-
if (!params?.clientId || !params?.alertTypeId) {
|
|
3
|
+
if (!params?.clientId || !params?.alertTypeId || !params?.name || !params?.description) {
|
|
4
4
|
logger.warn({ params }, 'ClientAlertConfigurationRepository::createClientAlertConfiguration - missing required parameters');
|
|
5
5
|
return null;
|
|
6
6
|
}
|
|
@@ -11,6 +11,7 @@ export const createClientAlertConfiguration = async (novaDataSource, params, log
|
|
|
11
11
|
clientId: params.clientId,
|
|
12
12
|
alertTypeId: params.alertTypeId,
|
|
13
13
|
name: params.name,
|
|
14
|
+
description: params.description,
|
|
14
15
|
status: params.status || 'active',
|
|
15
16
|
alertValue: params.alertValue,
|
|
16
17
|
alertMetadata: params.alertMetadata,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createClientAlertConfiguration.js","sourceRoot":"","sources":["../../../src/repositories/clientAlertConfiguration/createClientAlertConfiguration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AAKzD,MAAM,CAAC,MAAM,8BAA8B,GAAG,KAAK,EACjD,cAA8B,EAC9B,MAA4C,EAC5C,MAAc,EACqB,EAAE;IACrC,IAAI,CAAC,MAAM,EAAE,QAAQ,IAAI,CAAC,MAAM,EAAE,WAAW,EAAE;
|
|
1
|
+
{"version":3,"file":"createClientAlertConfiguration.js","sourceRoot":"","sources":["../../../src/repositories/clientAlertConfiguration/createClientAlertConfiguration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AAKzD,MAAM,CAAC,MAAM,8BAA8B,GAAG,KAAK,EACjD,cAA8B,EAC9B,MAA4C,EAC5C,MAAc,EACqB,EAAE;IACrC,IAAI,CAAC,MAAM,EAAE,QAAQ,IAAI,CAAC,MAAM,EAAE,WAAW,IAAI,CAAC,MAAM,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,WAAW,EAAE;QACtF,MAAM,CAAC,IAAI,CACT,EAAE,MAAM,EAAE,EACV,kGAAkG,CACnG,CAAA;QACD,OAAO,IAAI,CAAA;KACZ;IAED,OAAO,cAAc,CAAC,SAAS,CAAC,KAAK,EAAE,UAA0B,EAE/D,EAAE;QACF,MAAM,mCAAmC,GAAG,UAAU,CAAC,aAAa,CAAC,wBAAwB,CAAC,CAAA;QAE9F,MAAM,2BAA2B,GAAG;YAClC,EAAE,EAAE,MAAM,CAAC,EAAE;YACb,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,QAAQ;YACjC,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,KAAK;SACnC,CAAA;QAED,MAAM,MAAM,GAAG,MAAM,mCAAmC,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAA;QAE1F,OAAO,MAAM,CAAA;IACf,CAAC,EAAE,oEAAoE,CAAC,CAAA;AAC1E,CAAC,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ClientAlertConfiguration, ClientAlertRecipient, NotificationRecipient, } from '../../entities';
|
|
2
|
-
import { uuidStringToBinaryBuffer } from '../../utils/uuidHelpers';
|
|
1
|
+
import { ClientAlertConfiguration, ClientAlertRecipient, NotificationRecipient, User, UserAlertNotificationsConfig, UserSecurityRole, } from '../../entities';
|
|
2
|
+
import { binaryBufferToUuidString, uuidStringToBinaryBuffer } from '../../utils/uuidHelpers';
|
|
3
3
|
export const setClientAlertRecipients = async (novaDataSource, params, logger) => {
|
|
4
4
|
if (!params?.filters?.clientId || !params?.filters?.clientAlertConfigurationId) {
|
|
5
5
|
logger.error('ClientAlertConfigurationRepository::setClientAlertRecipients - missing required parameters');
|
|
@@ -13,27 +13,16 @@ export const setClientAlertRecipients = async (novaDataSource, params, logger) =
|
|
|
13
13
|
if (!existentClientAlertConfiguration) {
|
|
14
14
|
return false;
|
|
15
15
|
}
|
|
16
|
-
const setInternalRecipientsResult = await setInternalRecipients(dataSource, params.filters.clientAlertConfigurationId, params.values.globalAccountConfig, params.values.userIdRecipients, params.values.roleIdRecipients);
|
|
16
|
+
const setInternalRecipientsResult = await setInternalRecipients(dataSource, params.filters.clientAlertConfigurationId, params.filters.clientId, params.values.globalAccountConfig, params.values.userIdRecipients, params.values.roleIdRecipients);
|
|
17
17
|
if (!setInternalRecipientsResult) {
|
|
18
18
|
return false;
|
|
19
19
|
}
|
|
20
|
-
const setNotificationRecipientsResult = await
|
|
20
|
+
const setNotificationRecipientsResult = await setExternalRecipients(dataSource, params.filters.clientAlertConfigurationId, params.filters.clientId, params.values.externalRecipients);
|
|
21
21
|
return setNotificationRecipientsResult;
|
|
22
22
|
}, 'ClientAlertConfigurationRepository::setClientAlertRecipients');
|
|
23
23
|
};
|
|
24
|
-
const setInternalRecipients = async (dataSource, clientAlertConfigurationId, globalAccountConfig, userIdRecipients, roleIdRecipients) => {
|
|
25
|
-
const
|
|
26
|
-
await clientAlertRecipientsRepository
|
|
27
|
-
.createQueryBuilder()
|
|
28
|
-
.delete()
|
|
29
|
-
.where('clientAlertConfigurationId = :clientAlertConfigurationId', {
|
|
30
|
-
clientAlertConfigurationId: clientAlertConfigurationId,
|
|
31
|
-
})
|
|
32
|
-
.execute();
|
|
33
|
-
if (!userIdRecipients?.length && !roleIdRecipients?.length && !globalAccountConfig) {
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
const clientAlertRecipients = globalAccountConfig
|
|
24
|
+
const setInternalRecipients = async (dataSource, clientAlertConfigurationId, clientId, globalAccountConfig, userIdRecipients, roleIdRecipients) => {
|
|
25
|
+
const newClientAlertRecipients = globalAccountConfig
|
|
37
26
|
? [
|
|
38
27
|
{
|
|
39
28
|
id: null,
|
|
@@ -60,7 +49,7 @@ const setInternalRecipients = async (dataSource, clientAlertConfigurationId, glo
|
|
|
60
49
|
smsNotification: roleRecipient.smsNotification ?? false,
|
|
61
50
|
includeAllUsers: false,
|
|
62
51
|
})) ?? [];
|
|
63
|
-
|
|
52
|
+
newClientAlertRecipients.push(...roleRecipients);
|
|
64
53
|
const userRecipients = userIdRecipients?.map(userRecipient => ({
|
|
65
54
|
id: null,
|
|
66
55
|
clientAlertConfigurationId,
|
|
@@ -73,12 +62,25 @@ const setInternalRecipients = async (dataSource, clientAlertConfigurationId, glo
|
|
|
73
62
|
smsNotification: userRecipient.smsNotification ?? false,
|
|
74
63
|
includeAllUsers: false,
|
|
75
64
|
})) ?? [];
|
|
76
|
-
|
|
65
|
+
newClientAlertRecipients.push(...userRecipients);
|
|
66
|
+
await removeNotificationsConfigFromMissingRecipients(dataSource, clientAlertConfigurationId, clientId, newClientAlertRecipients);
|
|
67
|
+
const clientAlertRecipientsRepository = dataSource.getRepository(ClientAlertRecipient);
|
|
68
|
+
// remove all existing recipients to insert again
|
|
69
|
+
await clientAlertRecipientsRepository
|
|
70
|
+
.createQueryBuilder()
|
|
71
|
+
.delete()
|
|
72
|
+
.where('clientAlertConfigurationId = :clientAlertConfigurationId', {
|
|
73
|
+
clientAlertConfigurationId: clientAlertConfigurationId,
|
|
74
|
+
})
|
|
75
|
+
.execute();
|
|
76
|
+
if (!newClientAlertRecipients.length) {
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
77
79
|
const maxItemsPerQuery = 50;
|
|
78
80
|
const partitionedItems = [];
|
|
79
81
|
// We split the in groups of 50 to avoid having a query with too many items to insert
|
|
80
|
-
for (let i = 0; i <
|
|
81
|
-
partitionedItems.push(
|
|
82
|
+
for (let i = 0; i < newClientAlertRecipients.length; i += maxItemsPerQuery) {
|
|
83
|
+
partitionedItems.push(newClientAlertRecipients.slice(i, i + maxItemsPerQuery));
|
|
82
84
|
}
|
|
83
85
|
for (const recipients of partitionedItems) {
|
|
84
86
|
const result = await clientAlertRecipientsRepository.insert(recipients);
|
|
@@ -88,7 +90,7 @@ const setInternalRecipients = async (dataSource, clientAlertConfigurationId, glo
|
|
|
88
90
|
}
|
|
89
91
|
return true;
|
|
90
92
|
};
|
|
91
|
-
const
|
|
93
|
+
const setExternalRecipients = async (dataSource, clientAlertConfigurationId, clientId, externalRecipients) => {
|
|
92
94
|
const notificationRecipientsRepository = dataSource.getRepository(NotificationRecipient);
|
|
93
95
|
await notificationRecipientsRepository
|
|
94
96
|
.createQueryBuilder()
|
|
@@ -124,4 +126,48 @@ const setNotificationRecipients = async (dataSource, clientAlertConfigurationId,
|
|
|
124
126
|
}
|
|
125
127
|
return true;
|
|
126
128
|
};
|
|
129
|
+
const getAllUsersFromInternalUserRecipients = async (dataSource, clientAlertRecipients, clientId) => {
|
|
130
|
+
const allUsersRecipient = clientAlertRecipients.find(recipient => recipient.userId == null && recipient.roleId == null);
|
|
131
|
+
const usersRepository = dataSource.getRepository(User);
|
|
132
|
+
if (allUsersRecipient) {
|
|
133
|
+
const users = await usersRepository
|
|
134
|
+
.createQueryBuilder('user')
|
|
135
|
+
.where('clientId = :clientId', { clientId })
|
|
136
|
+
.getMany();
|
|
137
|
+
return users.map(user => binaryBufferToUuidString(user.id));
|
|
138
|
+
}
|
|
139
|
+
const resultSet = new Set();
|
|
140
|
+
const userRecipients = clientAlertRecipients.filter(recipient => recipient.userId != null);
|
|
141
|
+
userRecipients.forEach(recipient => {
|
|
142
|
+
resultSet.add(binaryBufferToUuidString(recipient.userId));
|
|
143
|
+
});
|
|
144
|
+
const roleRecipients = clientAlertRecipients
|
|
145
|
+
.filter(recipient => recipient.roleId != null)
|
|
146
|
+
.map(recipient => recipient.roleId);
|
|
147
|
+
if (roleRecipients.length > 0) {
|
|
148
|
+
const usersWithRoles = await usersRepository
|
|
149
|
+
.createQueryBuilder('user')
|
|
150
|
+
.innerJoin(UserSecurityRole, 'userSecurityRole', 'userSecurityRole.userId = user.id')
|
|
151
|
+
.where('user.clientId = :clientId', { clientId })
|
|
152
|
+
.andWhere('userSecurityRole.securityRoleId IN (:...roleIds)', { roleIds: roleRecipients })
|
|
153
|
+
.getMany();
|
|
154
|
+
usersWithRoles.forEach(user => resultSet.add(binaryBufferToUuidString(user.id)));
|
|
155
|
+
}
|
|
156
|
+
const result = Array.from(resultSet);
|
|
157
|
+
return result;
|
|
158
|
+
};
|
|
159
|
+
const removeNotificationsConfigFromMissingRecipients = async (dataSource, clientAlertConfigurationId, clientId, newClientAlertRecipients) => {
|
|
160
|
+
const usersFromNewRecipients = await getAllUsersFromInternalUserRecipients(dataSource, newClientAlertRecipients, clientId);
|
|
161
|
+
const userAlertNotificationsConfigRepository = dataSource.getRepository(UserAlertNotificationsConfig);
|
|
162
|
+
await userAlertNotificationsConfigRepository
|
|
163
|
+
.createQueryBuilder()
|
|
164
|
+
.delete()
|
|
165
|
+
.where('clientAlertConfigurationId = :clientAlertConfigurationId', {
|
|
166
|
+
clientAlertConfigurationId: clientAlertConfigurationId,
|
|
167
|
+
})
|
|
168
|
+
.andWhere('userId NOT IN (:...userIds)', {
|
|
169
|
+
userIds: usersFromNewRecipients.map(userId => uuidStringToBinaryBuffer(userId)),
|
|
170
|
+
})
|
|
171
|
+
.execute();
|
|
172
|
+
};
|
|
127
173
|
//# sourceMappingURL=setClientAlertRecipients.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setClientAlertRecipients.js","sourceRoot":"","sources":["../../../src/repositories/clientAlertConfiguration/setClientAlertRecipients.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"setClientAlertRecipients.js","sourceRoot":"","sources":["../../../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AG,UAAU,CAAC,aAAa,CACrE,4BAA4B,CAC7B,CAAA;IAED,MAAM,sCAAsC;SACzC,kBAAkB,EAAE;SACpB,MAAM,EAAE;SACR,KAAK,CAAC,0DAA0D,EAAE;QACjE,0BAA0B,EAAE,0BAA0B;KACvD,CAAC;SACD,QAAQ,CAAC,6BAA6B,EAAE;QACvC,OAAO,EAAE,sBAAsB,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,wBAAwB,CAAC,MAAM,CAAC,CAAC;KAChF,CAAC;SACD,OAAO,EAAE,CAAA;AACd,CAAC,CAAA"}
|
|
@@ -11,6 +11,7 @@ export const updateClientAlertConfiguration = async (novaDataSource, params, log
|
|
|
11
11
|
!params?.values?.alertMetadata &&
|
|
12
12
|
!params?.values?.filter &&
|
|
13
13
|
!params?.values?.name &&
|
|
14
|
+
!params?.values?.description &&
|
|
14
15
|
params?.values?.readOnly == null) {
|
|
15
16
|
logger.warn({ params }, 'ClientAlertConfigurationRepository::updateClientAlertConfiguration - missing required parameters');
|
|
16
17
|
return false;
|
|
@@ -26,6 +27,7 @@ export const updateClientAlertConfiguration = async (novaDataSource, params, log
|
|
|
26
27
|
readOnly: params?.values?.readOnly,
|
|
27
28
|
filter: params?.values?.filter,
|
|
28
29
|
name: params?.values?.name,
|
|
30
|
+
description: params?.values?.description,
|
|
29
31
|
status: params?.values?.status,
|
|
30
32
|
})
|
|
31
33
|
.where('clientId = :clientId', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateClientAlertConfiguration.js","sourceRoot":"","sources":["../../../src/repositories/clientAlertConfiguration/updateClientAlertConfiguration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AAKzD,MAAM,CAAC,MAAM,8BAA8B,GAAG,KAAK,EACjD,cAA8B,EAC9B,MAA4C,EAC5C,MAAc,EACI,EAAE;IACpB,4BAA4B;IAC5B,IAAI,CAAC,MAAM,EAAE,OAAO,E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C,0BAA0B,EAAE,MAAM,CAAC,OAAO,CAAC,0BAA0B;SACtE,CAAC,CAAA;QAEJ,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,OAAO,EAAE,CAAA;QAE3C,OAAO,MAAM,CAAC,QAAQ,GAAG,CAAC,CAAA;IAC5B,CAAC,EAAE,oEAAoE,CAAC,CAAA;AAC1E,CAAC,CAAA"}
|
|
1
|
+
{"version":3,"file":"updateClientAlertConfiguration.js","sourceRoot":"","sources":["../../../src/repositories/clientAlertConfiguration/updateClientAlertConfiguration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AAKzD,MAAM,CAAC,MAAM,8BAA8B,GAAG,KAAK,EACjD,cAA8B,EAC9B,MAA4C,EAC5C,MAAc,EACI,EAAE;IACpB,4BAA4B;IAC5B,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,0BAA0B,EAAE;QAC9E,MAAM,CAAC,IAAI,CACT,EAAE,MAAM,EAAE,EACV,kGAAkG,CACnG,CAAA;QACD,OAAO,KAAK,CAAA;KACb;IAED,2CAA2C;IAC3C,IACE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM;QACvB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU;QAC3B,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa;QAC9B,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM;QACvB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI;QACrB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW;QAC5B,MAAM,EAAE,MAAM,EAAE,QAAQ,IAAI,IAAI,EAChC;QACA,MAAM,CAAC,IAAI,CACT,EAAE,MAAM,EAAE,EACV,kGAAkG,CACnG,CAAA;QACD,OAAO,KAAK,CAAA;KACb;IAED,OAAO,cAAc,CAAC,SAAS,CAAC,KAAK,EAAE,UAA0B,EAAoB,EAAE;QACrF,MAAM,mCAAmC,GAAG,UAAU,CAAC,aAAa,CAAC,wBAAwB,CAAC,CAAA;QAE9F,MAAM,YAAY,GAAG,mCAAmC;aACrD,kBAAkB,EAAE;aACpB,MAAM,CAAC,wBAAwB,CAAC;aAChC,GAAG,CAAC;YACH,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU;YACtC,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa;YAC5C,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ;YAClC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;YAC9B,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI;YAC1B,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW;YACxC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;SAC/B,CAAC;aACD,KAAK,CAAC,sBAAsB,EAAE;YAC7B,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,QAAQ;SAClC,CAAC;aACD,QAAQ,CAAC,kCAAkC,EAAE;YAC5C,0BAA0B,EAAE,MAAM,CAAC,OAAO,CAAC,0BAA0B;SACtE,CAAC,CAAA;QAEJ,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,OAAO,EAAE,CAAA;QAE3C,OAAO,MAAM,CAAC,QAAQ,GAAG,CAAC,CAAA;IAC5B,CAAC,EAAE,oEAAoE,CAAC,CAAA;AAC1E,CAAC,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { NovaDataSource } from '../../novaDataSource';
|
|
2
|
+
import { Logger } from '../../types/logger';
|
|
3
|
+
import { DeleteUserAlertNotificationsConfigParams } from '../../types/userConfigurations';
|
|
4
|
+
export declare const deleteUserAlertNotificationsConfig: (novaDataSource: NovaDataSource, params: DeleteUserAlertNotificationsConfigParams, logger: Logger) => Promise<boolean>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { UserAlertNotificationsConfig } from '../../entities';
|
|
2
|
+
import { uuidStringToBinaryBuffer } from '../../utils/uuidHelpers';
|
|
3
|
+
export const deleteUserAlertNotificationsConfig = async (novaDataSource, params, logger) => {
|
|
4
|
+
// userId filter is required
|
|
5
|
+
if (!params?.filters?.userId) {
|
|
6
|
+
logger.warn({ params }, 'UserConfigurationsRepository::deleteUserAlertNotificationsConfig - missing required parameters');
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
const userIdBinaryBuffer = uuidStringToBinaryBuffer(params?.filters?.userId);
|
|
10
|
+
// at least one filter is required
|
|
11
|
+
if (params?.filters?.userId && !userIdBinaryBuffer) {
|
|
12
|
+
logger.warn({ userId: params?.filters?.userId }, 'UserConfigurationsRepository::deleteUserAlertNotificationsConfig - user id should be a valid UUID');
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
return novaDataSource.safeQuery(async (dataSource) => {
|
|
16
|
+
const userAlertNotificationsConfigRepository = dataSource.getRepository(UserAlertNotificationsConfig);
|
|
17
|
+
let queryBuilder = userAlertNotificationsConfigRepository.createQueryBuilder().delete();
|
|
18
|
+
if (userIdBinaryBuffer) {
|
|
19
|
+
queryBuilder = queryBuilder.where('userId = :userId', { userId: userIdBinaryBuffer });
|
|
20
|
+
}
|
|
21
|
+
if (params?.filters?.clientAlertConfigurationIds?.length) {
|
|
22
|
+
queryBuilder = queryBuilder.andWhere('clientAlertConfigurationId IN (:...clientAlertConfigurationIds)', {
|
|
23
|
+
clientAlertConfigurationIds: params.filters.clientAlertConfigurationIds,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
const result = await queryBuilder.execute();
|
|
27
|
+
return result.affected > 0;
|
|
28
|
+
}, 'UserConfigurationsRepository::deleteUserAlertNotificationsConfig');
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=deleteUserAlertNotificationsConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deleteUserAlertNotificationsConfig.js","sourceRoot":"","sources":["../../../src/repositories/userConfigurations/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A2B;aACxE,CACF,CAAA;SACF;QAED,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,OAAO,EAAE,CAAA;QAE3C,OAAO,MAAM,CAAC,QAAQ,GAAG,CAAC,CAAA;IAC5B,CAAC,EAAE,kEAAkE,CAAC,CAAA;AACxE,CAAC,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { UserAlertNotificationsConfig } from '../../entities';
|
|
2
|
+
import { NovaDataSource } from '../../novaDataSource';
|
|
3
|
+
import { Logger } from '../../types/logger';
|
|
4
|
+
import { GetUserAlertNotificationsConfigParams } from '../../types/userConfigurations';
|
|
5
|
+
export declare const getUserAlertNotificationsConfig: (novaDataSource: NovaDataSource, params: GetUserAlertNotificationsConfigParams, logger: Logger) => Promise<UserAlertNotificationsConfig[]>;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { ClientAlertConfiguration, ClientAlertRecipient, User, UserAlertNotificationsConfig, UserSecurityRole, } from '../../entities';
|
|
2
|
+
import { binaryBufferToUuidString, uuidStringToBinaryBuffer } from '../../utils/uuidHelpers';
|
|
3
|
+
export const getUserAlertNotificationsConfig = async (novaDataSource, params, logger) => {
|
|
4
|
+
// userId filter is required
|
|
5
|
+
if (!params?.filters?.userId) {
|
|
6
|
+
logger.warn({ params }, 'UserConfigurationsRepository::getUserAlertNotificationsConfig - missing required parameters');
|
|
7
|
+
return [];
|
|
8
|
+
}
|
|
9
|
+
const userIdBinaryBuffer = uuidStringToBinaryBuffer(params?.filters?.userId);
|
|
10
|
+
if (!userIdBinaryBuffer) {
|
|
11
|
+
logger.warn({ params }, 'UserConfigurationsRepository::getUserAlertNotificationsConfig - user id should be a valid UUID');
|
|
12
|
+
return [];
|
|
13
|
+
}
|
|
14
|
+
// Force the query to run on master or slave
|
|
15
|
+
const dbQueryRunner = novaDataSource.createQueryRunnerFromParams(params);
|
|
16
|
+
return novaDataSource.safeQuery(async (dataSource, queryRunner) => {
|
|
17
|
+
const userRoles = await getUserRoles(dataSource, userIdBinaryBuffer, queryRunner);
|
|
18
|
+
const clientAlertConfigurations = await getClientAlertConfigurationsForUser(dataSource, userIdBinaryBuffer, userRoles, queryRunner);
|
|
19
|
+
const existingUserAlertNotificationConfigs = clientAlertConfigurations?.length
|
|
20
|
+
? await getExistingUserAlertNotificationConfigs(dataSource, userIdBinaryBuffer, clientAlertConfigurations, queryRunner)
|
|
21
|
+
: [];
|
|
22
|
+
const missingConfigs = clientAlertConfigurations.filter(config => !existingUserAlertNotificationConfigs?.find(existingConfig => existingConfig.clientAlertConfigurationId === config.id));
|
|
23
|
+
const missingConfigsRecipients = await getConfigurationRecipients(dataSource, missingConfigs?.map(config => config.id), queryRunner);
|
|
24
|
+
const result = clientAlertConfigurations.map(config => {
|
|
25
|
+
const notificationsConfig = existingUserAlertNotificationConfigs.find(existingConfig => existingConfig.clientAlertConfigurationId === config.id);
|
|
26
|
+
if (notificationsConfig) {
|
|
27
|
+
return notificationsConfig;
|
|
28
|
+
}
|
|
29
|
+
const userRecipient = missingConfigsRecipients.find(recipient => recipient.clientAlertConfigurationId === config.id &&
|
|
30
|
+
binaryBufferToUuidString(recipient.userId) == params.filters.userId);
|
|
31
|
+
if (userRecipient) {
|
|
32
|
+
return {
|
|
33
|
+
id: null,
|
|
34
|
+
clientAlertConfigurationId: config.id,
|
|
35
|
+
userId: userIdBinaryBuffer,
|
|
36
|
+
smsNotification: userRecipient.smsNotification,
|
|
37
|
+
emailNotification: userRecipient.emailNotification,
|
|
38
|
+
appNotification: userRecipient.appNotification,
|
|
39
|
+
pushNotification: userRecipient.pushNotification,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const roleRecipient = missingConfigsRecipients.find(recipient => recipient.clientAlertConfigurationId === config.id &&
|
|
43
|
+
userRoles.find(role => role.securityRoleId === recipient.roleId));
|
|
44
|
+
if (roleRecipient) {
|
|
45
|
+
return {
|
|
46
|
+
id: null,
|
|
47
|
+
clientAlertConfigurationId: config.id,
|
|
48
|
+
userId: userIdBinaryBuffer,
|
|
49
|
+
smsNotification: roleRecipient.smsNotification,
|
|
50
|
+
emailNotification: roleRecipient.emailNotification,
|
|
51
|
+
appNotification: roleRecipient.appNotification,
|
|
52
|
+
pushNotification: roleRecipient.pushNotification,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
const allUsersRecipient = missingConfigsRecipients.find(recipient => recipient.clientAlertConfigurationId === config.id &&
|
|
56
|
+
recipient.userId == null &&
|
|
57
|
+
recipient.roleId == null);
|
|
58
|
+
if (allUsersRecipient) {
|
|
59
|
+
return {
|
|
60
|
+
id: null,
|
|
61
|
+
clientAlertConfigurationId: config.id,
|
|
62
|
+
userId: userIdBinaryBuffer,
|
|
63
|
+
smsNotification: allUsersRecipient.smsNotification,
|
|
64
|
+
emailNotification: allUsersRecipient.emailNotification,
|
|
65
|
+
appNotification: allUsersRecipient.appNotification,
|
|
66
|
+
pushNotification: allUsersRecipient.pushNotification,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
return result;
|
|
71
|
+
}, 'UserConfigurationsRepository::getUserAlertNotificationsConfig', dbQueryRunner);
|
|
72
|
+
};
|
|
73
|
+
const getUserRoles = async (dataSource, userIdBinaryBuffer, queryRunner) => {
|
|
74
|
+
const userSecurityRoleRepository = dataSource.getRepository(UserSecurityRole);
|
|
75
|
+
const queryBuilder = userSecurityRoleRepository.createQueryBuilder('userSecurityRole');
|
|
76
|
+
if (queryRunner) {
|
|
77
|
+
queryBuilder.setQueryRunner(queryRunner);
|
|
78
|
+
}
|
|
79
|
+
const userSecurityRoles = await queryBuilder
|
|
80
|
+
.innerJoin(User, 'user', 'user.id = userSecurityRole.userId and user.clientId = userSecurityRole.clientId')
|
|
81
|
+
.where('userId = :userId', {
|
|
82
|
+
userId: userIdBinaryBuffer,
|
|
83
|
+
})
|
|
84
|
+
.getMany();
|
|
85
|
+
return userSecurityRoles;
|
|
86
|
+
};
|
|
87
|
+
const getExistingUserAlertNotificationConfigs = async (dataSource, userIdBinaryBuffer, clientAlertConfigurations, queryRunner) => {
|
|
88
|
+
const userAlertNotificationsConfigRepository = dataSource.getRepository(UserAlertNotificationsConfig);
|
|
89
|
+
const userAlertNotificationsConfifQueryBuilder = userAlertNotificationsConfigRepository.createQueryBuilder();
|
|
90
|
+
if (queryRunner) {
|
|
91
|
+
userAlertNotificationsConfifQueryBuilder.setQueryRunner(queryRunner);
|
|
92
|
+
}
|
|
93
|
+
const existingConfigs = await userAlertNotificationsConfifQueryBuilder
|
|
94
|
+
.where('userId = :userId and clientAlertConfigurationId IN (:...clientAlertConfigurationIds)', {
|
|
95
|
+
userId: userIdBinaryBuffer,
|
|
96
|
+
clientAlertConfigurationIds: clientAlertConfigurations.map(config => config.id),
|
|
97
|
+
})
|
|
98
|
+
.getMany();
|
|
99
|
+
return existingConfigs;
|
|
100
|
+
};
|
|
101
|
+
const getClientAlertConfigurationsForUser = async (dataSource, userIdBinaryBuffer, userRoles, queryRunner) => {
|
|
102
|
+
const clientAlertConfigurationsRepository = dataSource.getRepository(ClientAlertConfiguration);
|
|
103
|
+
let queryBuilder = clientAlertConfigurationsRepository
|
|
104
|
+
.createQueryBuilder('clientAlertConfiguration')
|
|
105
|
+
.distinct(true);
|
|
106
|
+
if (queryRunner) {
|
|
107
|
+
queryBuilder.setQueryRunner(queryRunner);
|
|
108
|
+
}
|
|
109
|
+
queryBuilder = queryBuilder
|
|
110
|
+
.innerJoin(User, 'user', 'user.clientId = clientAlertConfiguration.clientId and user.id = :userId', {
|
|
111
|
+
userId: userIdBinaryBuffer,
|
|
112
|
+
}) // client alert configurations for the clientId of the user
|
|
113
|
+
.leftJoin(ClientAlertRecipient, 'clientAlertRecipient', 'clientAlertConfiguration.id = clientAlertRecipient.clientAlertConfigurationId')
|
|
114
|
+
.where('clientAlertRecipient.userId IS NULL AND clientAlertRecipient.roleId IS NULL') // all users in the account
|
|
115
|
+
.orWhere('clientAlertRecipient.userId IS NOT NULL and clientAlertRecipient.userId = :userId', {
|
|
116
|
+
userId: userIdBinaryBuffer,
|
|
117
|
+
}); // user recipient
|
|
118
|
+
if (userRoles.length > 0) {
|
|
119
|
+
queryBuilder.orWhere('clientAlertRecipient.roleId IS NOT NULL and clientAlertRecipient.roleId IN (:...roleIds)', {
|
|
120
|
+
roleIds: userRoles.map(role => role.securityRoleId),
|
|
121
|
+
}); // role recipient
|
|
122
|
+
}
|
|
123
|
+
const clientAlertConfigurations = await queryBuilder.getMany();
|
|
124
|
+
return clientAlertConfigurations;
|
|
125
|
+
};
|
|
126
|
+
const getConfigurationRecipients = async (dataSource, clientAlertConfigurationIds, queryRunner) => {
|
|
127
|
+
if (!clientAlertConfigurationIds.length) {
|
|
128
|
+
return [];
|
|
129
|
+
}
|
|
130
|
+
const configurationRecipientsRepository = dataSource.getRepository(ClientAlertRecipient);
|
|
131
|
+
const configurationRecipientsQueryBuilder = configurationRecipientsRepository.createQueryBuilder();
|
|
132
|
+
if (queryRunner) {
|
|
133
|
+
configurationRecipientsQueryBuilder.setQueryRunner(queryRunner);
|
|
134
|
+
}
|
|
135
|
+
const missingConfigRecipients = await configurationRecipientsQueryBuilder
|
|
136
|
+
.where('clientAlertConfigurationId IN (:...clientAlertConfigurationIds)', {
|
|
137
|
+
clientAlertConfigurationIds,
|
|
138
|
+
})
|
|
139
|
+
.getMany();
|
|
140
|
+
return missingConfigRecipients;
|
|
141
|
+
};
|
|
142
|
+
//# sourceMappingURL=getUserAlertNotificationsConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getUserAlertNotificationsConfig.js","sourceRoot":"","sources":["../../../src/repositories/userConfigurations/getUserAlertNotificationsConfig.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,IAAI,EACJ,4BAA4B,EAC5B,gBAAgB,GACjB,MAAM,gBAAgB,CAAA;AAIvB,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAA;AA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D,QAAQ,CACP,oBAAoB,EACpB,sBAAsB,EACtB,+EAA+E,CAChF;SACA,KAAK,CAAC,6EAA6E,CAAC,CAAC,2BAA2B;SAChH,OAAO,CAAC,mFAAmF,EAAE;QAC5F,MAAM,EAAE,kBAAkB;KAC3B,CAAC,CAAA,CAAC,iBAAiB;IAEtB,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;QACxB,YAAY,CAAC,OAAO,CAClB,0FAA0F,EAC1F;YACE,OAAO,EAAE,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC;SACpD,CACF,CAAA,CAAC,iBAAiB;KACpB;IAED,MAAM,yBAAyB,GAAG,MAAM,YAAY,CAAC,OAAO,EAAE,CAAA;IAE9D,OAAO,yBAAyB,CAAA;AAClC,CAAC,CAAA;AAED,MAAM,0BAA0B,GAAG,KAAK,EACtC,UAA0B,EAC1B,2BAAqC,EACrC,WAAyB,EACQ,EAAE;IACnC,IAAI,CAAC,2BAA2B,CAAC,MAAM,EAAE;QACvC,OAAO,EAAE,CAAA;KACV;IAED,MAAM,iCAAiC,GAAG,UAAU,CAAC,aAAa,CAAC,oBAAoB,CAAC,CAAA;IAExF,MAAM,mCAAmC,GAAG,iCAAiC,CAAC,kBAAkB,EAAE,CAAA;IAElG,IAAI,WAAW,EAAE;QACf,mCAAmC,CAAC,cAAc,CAAC,WAAW,CAAC,CAAA;KAChE;IAED,MAAM,uBAAuB,GAAG,MAAM,mCAAmC;SACtE,KAAK,CAAC,iEAAiE,EAAE;QACxE,2BAA2B;KAC5B,CAAC;SACD,OAAO,EAAE,CAAA;IAEZ,OAAO,uBAAuB,CAAA;AAChC,CAAC,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UserAlertConfiguration, UserConfiguration } from '../../entities';
|
|
2
|
-
import { BulkCreateUserAlertConfigurationsParams, CreateUserAlertConfigurationParams, CreateUserConfigurationParams, DeleteUserAlertConfigurationsParams, DeleteUserConfigurationParams, GetUserAlertConfigurationsParams, GetUserConfigurationsParams, UpdateUserAlertConfigurationByIdParams, UpdateUserAlertConfigurationsParams, UpdateUserConfigurationParams } from '../../types/userConfigurations';
|
|
1
|
+
import { UserAlertConfiguration, UserAlertNotificationsConfig, UserConfiguration } from '../../entities';
|
|
2
|
+
import { BulkCreateUserAlertConfigurationsParams, CreateUserAlertConfigurationParams, CreateUserConfigurationParams, DeleteUserAlertConfigurationsParams, DeleteUserAlertNotificationsConfigParams, DeleteUserConfigurationParams, GetUserAlertConfigurationsParams, GetUserAlertNotificationsConfigParams, GetUserConfigurationsParams, UpdateUserAlertConfigurationByIdParams, UpdateUserAlertConfigurationsParams, UpdateUserConfigurationParams, UpsertUserAlertNotificationsConfigParams } from '../../types/userConfigurations';
|
|
3
3
|
import { BaseRepository } from '../baseRepository';
|
|
4
4
|
export declare class UserConfigurationsRepository extends BaseRepository {
|
|
5
5
|
/**
|
|
@@ -146,4 +146,7 @@ export declare class UserConfigurationsRepository extends BaseRepository {
|
|
|
146
146
|
* @returns Whether the user alert configurations were deleted
|
|
147
147
|
*/
|
|
148
148
|
deleteUserAlertConfigurations(params: DeleteUserAlertConfigurationsParams): Promise<boolean>;
|
|
149
|
+
getUserAlertNotificationsConfig: (params: GetUserAlertNotificationsConfigParams) => Promise<UserAlertNotificationsConfig[]>;
|
|
150
|
+
upsertUserAlertNotificationsConfig: (params: UpsertUserAlertNotificationsConfigParams) => Promise<boolean>;
|
|
151
|
+
deleteUserAlertNotificationsConfig: (params: DeleteUserAlertNotificationsConfigParams) => Promise<boolean>;
|
|
149
152
|
}
|
|
@@ -4,12 +4,15 @@ import { bulkCreateUserAlertConfigurations } from './bulkCreateUserAlertConfigur
|
|
|
4
4
|
import { createUserAlertConfiguration } from './createUserAlertConfiguration';
|
|
5
5
|
import { createUserConfiguration } from './createUserConfiguration';
|
|
6
6
|
import { deleteUserAlertConfigurations } from './deleteUserAlertConfigurations';
|
|
7
|
+
import { deleteUserAlertNotificationsConfig } from './deleteUserAlertNotificationsConfig';
|
|
7
8
|
import { deleteUserConfiguration } from './deleteUserConfiguration';
|
|
8
9
|
import { getUserAlertConfigurations } from './getUserAlertConfigurations';
|
|
10
|
+
import { getUserAlertNotificationsConfig } from './getUserAlertNotificationsConfig';
|
|
9
11
|
import { getUserConfigurations } from './getUserConfigurations';
|
|
10
12
|
import { updateUserAlertConfigurations } from './updateUserAlertConfigurations';
|
|
11
13
|
import { updateUserAlertConfigurationById } from './updateUserAlertConfigurationsByIds';
|
|
12
14
|
import { updateUserConfiguration } from './updateUserConfiguration';
|
|
15
|
+
import { upsertUserAlertNotificationsConfig } from './upsertUserAlertNotificationsConfig';
|
|
13
16
|
export class UserConfigurationsRepository extends BaseRepository {
|
|
14
17
|
/**
|
|
15
18
|
* Get user configurations
|
|
@@ -215,5 +218,26 @@ export class UserConfigurationsRepository extends BaseRepository {
|
|
|
215
218
|
this.logger.trace({ result }, 'UserConfigurationsRepository::deleteUserAlertConfigurations result');
|
|
216
219
|
return result;
|
|
217
220
|
}
|
|
221
|
+
getUserAlertNotificationsConfig = async (params) => {
|
|
222
|
+
this.logger.trace(params, 'UserConfigurationsRepository::getUserAlertNotificationsConfig started with params');
|
|
223
|
+
const novaDataSource = new NovaDataSource(this.novaDataSourceConfig, this.logger, this.replicaNovaDataSourceConfig);
|
|
224
|
+
const result = await getUserAlertNotificationsConfig(novaDataSource, params, this.logger);
|
|
225
|
+
this.logger.trace({ result }, 'UserConfigurationsRepository::getUserAlertNotificationsConfig result');
|
|
226
|
+
return result;
|
|
227
|
+
};
|
|
228
|
+
upsertUserAlertNotificationsConfig = async (params) => {
|
|
229
|
+
this.logger.trace(params, 'UserConfigurationsRepository::upsertUserAlertNotificationsConfig started with params');
|
|
230
|
+
const novaDataSource = new NovaDataSource(this.novaDataSourceConfig, this.logger, this.replicaNovaDataSourceConfig);
|
|
231
|
+
const result = await upsertUserAlertNotificationsConfig(novaDataSource, params, this.logger);
|
|
232
|
+
this.logger.trace({ result }, 'UserConfigurationsRepository::upsertUserAlertNotificationsConfig result');
|
|
233
|
+
return result;
|
|
234
|
+
};
|
|
235
|
+
deleteUserAlertNotificationsConfig = async (params) => {
|
|
236
|
+
this.logger.trace(params, 'UserConfigurationsRepository::deleteUserAlertNotificationsConfig started with params');
|
|
237
|
+
const novaDataSource = new NovaDataSource(this.novaDataSourceConfig, this.logger, this.replicaNovaDataSourceConfig);
|
|
238
|
+
const result = await deleteUserAlertNotificationsConfig(novaDataSource, params, this.logger);
|
|
239
|
+
this.logger.trace({ result }, 'UserConfigurationsRepository::deleteUserAlertNotificationsConfig result');
|
|
240
|
+
return result;
|
|
241
|
+
};
|
|
218
242
|
}
|
|
219
243
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/repositories/userConfigurations/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/repositories/userConfigurations/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAgBrD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAA;AACvF,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAA;AAC7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AACnE,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAA;AAC/E,OAAO,EAAE,kCAAkC,EAAE,MAAM,sCAAsC,CAAA;AACzF,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AACnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAA;AACzE,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAA;AACnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAy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AC,MAAM,EACX,IAAI,CAAC,2BAA2B,CACjC,CAAA;QAED,MAAM,MAAM,GAAG,MAAM,kCAAkC,CAAC,cAAc,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;QAE5F,IAAI,CAAC,MAAM,CAAC,KAAK,CACf,EAAE,MAAM,EAAE,EACV,yEAAyE,CAC1E,CAAA;QAED,OAAO,MAAM,CAAA;IACf,CAAC,CAAA;CACF"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { NovaDataSource } from '../../novaDataSource';
|
|
2
|
+
import { Logger } from '../../types/logger';
|
|
3
|
+
import { UpsertUserAlertNotificationsConfigParams } from '../../types/userConfigurations';
|
|
4
|
+
export declare const upsertUserAlertNotificationsConfig: (novaDataSource: NovaDataSource, params: UpsertUserAlertNotificationsConfigParams, logger: Logger) => Promise<boolean>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { UserAlertNotificationsConfig } from '../../entities';
|
|
2
|
+
import { uuidStringToBinaryBuffer } from '../../utils/uuidHelpers';
|
|
3
|
+
export const upsertUserAlertNotificationsConfig = async (novaDataSource, params, logger) => {
|
|
4
|
+
if (!params?.userId || !params?.clientAlertConfigurationId) {
|
|
5
|
+
logger.warn({ params }, 'UserConfigurationsRepository::upsertUserAlertNotificationsConfig - missing required parameters');
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
return novaDataSource.safeQuery(async (dataSource) => {
|
|
9
|
+
const userAlertNotificationsConfigRepository = dataSource.getRepository(UserAlertNotificationsConfig);
|
|
10
|
+
const userIdBinaryBuffer = uuidStringToBinaryBuffer(params?.userId);
|
|
11
|
+
if (!userIdBinaryBuffer?.length) {
|
|
12
|
+
logger.warn(params, 'UserConfigurationsRepository::upsertUserAlertNotificationsConfig - User alert configuration could not be created: user id should be a valid UUID');
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
const newUserAlertConfiguration = {
|
|
16
|
+
id: params?.id,
|
|
17
|
+
userId: userIdBinaryBuffer,
|
|
18
|
+
clientAlertConfigurationId: params?.clientAlertConfigurationId,
|
|
19
|
+
smsNotification: params?.smsNotification ?? false,
|
|
20
|
+
emailNotification: params?.emailNotification ?? false,
|
|
21
|
+
appNotification: params?.appNotification ?? false,
|
|
22
|
+
pushNotification: params?.pushNotification ?? false,
|
|
23
|
+
};
|
|
24
|
+
const result = await userAlertNotificationsConfigRepository.upsert(newUserAlertConfiguration, {
|
|
25
|
+
conflictPaths: ['userId', 'clientAlertConfigurationId'],
|
|
26
|
+
});
|
|
27
|
+
return result?.raw?.affectedRows > 0;
|
|
28
|
+
}, 'UserConfigurationsRepository::upsertUserAlertNotificationsConfig');
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=upsertUserAlertNotificationsConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upsertUserAlertNotificationsConfig.js","sourceRoot":"","sources":["../../../src/repositories/userConfigurations/upsertUserAlertNotificationsConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAA;AAI7D,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAA;AAElE,MAAM,CAAC,MAAM,kCAAkC,GAAG,KAAK,EACrD,cAA8B,EAC9B,MAAgD,EAChD,MAAc,EACI,EAAE;IACpB,IAAI,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC,MAAM,EAAE,0BAA0B,EAAE;QAC1D,MAAM,CAAC,IAAI,CACT,EAAE,MAAM,EAAE,EACV,gGAAgG,CACjG,CAAA;QACD,OAAO,IAAI,CAAA;KACZ;IAED,OAAO,cAAc,CAAC,SAAS,CAAC,KAAK,EAAE,UAA0B,EAAoB,EAAE;QACrF,MAAM,sCAAsC,GAAG,UAAU,CAAC,aAAa,CACrE,4BAA4B,CAC7B,CAAA;QAED,MAAM,kBAAkB,GAAG,wBAAwB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QAEnE,IAAI,CAAC,kBAAkB,EAAE,MAAM,EAAE;YAC/B,MAAM,CAAC,IAAI,CACT,MAAM,EACN,kJAAkJ,CACnJ,CAAA;YACD,OAAO,IAAI,CAAA;SACZ;QAED,MAAM,yBAAyB,GAAG;YAChC,EAAE,EAAE,MAAM,EAAE,EAAE;YACd,MAAM,EAAE,kBAAkB;YAC1B,0BAA0B,EAAE,MAAM,EAAE,0BAA0B;YAC9D,eAAe,EAAE,MAAM,EAAE,eAAe,IAAI,KAAK;YACjD,iBAAiB,EAAE,MAAM,EAAE,iBAAiB,IAAI,KAAK;YACrD,eAAe,EAAE,MAAM,EAAE,eAAe,IAAI,KAAK;YACjD,gBAAgB,EAAE,MAAM,EAAE,gBAAgB,IAAI,KAAK;SACpD,CAAA;QAED,MAAM,MAAM,GAAG,MAAM,sCAAsC,CAAC,MAAM,CAAC,yBAAyB,EAAE;YAC5F,aAAa,EAAE,CAAC,QAAQ,EAAE,4BAA4B,CAAC;SACxD,CAAC,CAAA;QAEF,OAAO,MAAM,EAAE,GAAG,EAAE,YAAY,GAAG,CAAC,CAAA;IACtC,CAAC,EAAE,kEAAkE,CAAC,CAAA;AACxE,CAAC,CAAA"}
|
|
@@ -16,7 +16,8 @@ export interface CreateClientAlertConfigurationParams {
|
|
|
16
16
|
id?: number;
|
|
17
17
|
clientId: number;
|
|
18
18
|
alertTypeId: number;
|
|
19
|
-
name
|
|
19
|
+
name: string;
|
|
20
|
+
description: string;
|
|
20
21
|
status?: 'active' | 'inactive' | 'deleted';
|
|
21
22
|
alertValue?: string;
|
|
22
23
|
alertMetadata?: string;
|
|
@@ -30,6 +31,7 @@ export interface UpdateClientAlertConfigurationParams {
|
|
|
30
31
|
};
|
|
31
32
|
values: {
|
|
32
33
|
name?: string;
|
|
34
|
+
description?: string;
|
|
33
35
|
status?: 'active' | 'inactive' | 'deleted';
|
|
34
36
|
alertValue?: string;
|
|
35
37
|
alertMetadata?: string;
|
|
@@ -105,3 +105,23 @@ export interface DeleteUserAlertConfigurationsParams {
|
|
|
105
105
|
userAlertConfigurationIds?: number[];
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
|
+
export interface GetUserAlertNotificationsConfigParams extends BaseSelectQueryParams {
|
|
109
|
+
filters: {
|
|
110
|
+
userId: string;
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
export interface UpsertUserAlertNotificationsConfigParams {
|
|
114
|
+
id?: number;
|
|
115
|
+
clientAlertConfigurationId: number;
|
|
116
|
+
userId: string;
|
|
117
|
+
smsNotification: boolean;
|
|
118
|
+
emailNotification: boolean;
|
|
119
|
+
appNotification: boolean;
|
|
120
|
+
pushNotification: boolean;
|
|
121
|
+
}
|
|
122
|
+
export interface DeleteUserAlertNotificationsConfigParams {
|
|
123
|
+
filters: {
|
|
124
|
+
userId: string;
|
|
125
|
+
clientAlertConfigurationIds?: number[];
|
|
126
|
+
};
|
|
127
|
+
}
|