@spytecgps/nova-orm 1.0.126 → 1.0.128

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.
Files changed (52) hide show
  1. package/dist/entities/clientAlertConfiguration.d.ts +16 -0
  2. package/dist/entities/clientAlertConfiguration.js +85 -0
  3. package/dist/entities/clientAlertConfiguration.js.map +1 -0
  4. package/dist/entities/clientAlertRecipient.d.ts +15 -0
  5. package/dist/entities/clientAlertRecipient.js +98 -0
  6. package/dist/entities/clientAlertRecipient.js.map +1 -0
  7. package/dist/entities/dataExport.js +1 -1
  8. package/dist/entities/dataExport.js.map +1 -1
  9. package/dist/entities/index.d.ts +6 -1
  10. package/dist/entities/index.js +6 -1
  11. package/dist/entities/index.js.map +1 -1
  12. package/dist/entities/notificationRecipient.d.ts +3 -0
  13. package/dist/entities/notificationRecipient.js +12 -0
  14. package/dist/entities/notificationRecipient.js.map +1 -1
  15. package/dist/entities/userAlertNotificationsConfig.d.ts +10 -0
  16. package/dist/entities/userAlertNotificationsConfig.js +79 -0
  17. package/dist/entities/userAlertNotificationsConfig.js.map +1 -0
  18. package/dist/index.js +1 -1
  19. package/dist/repositories/clientAlertConfiguration/createClientAlertConfiguration.d.ts +5 -0
  20. package/dist/repositories/clientAlertConfiguration/createClientAlertConfiguration.js +24 -0
  21. package/dist/repositories/clientAlertConfiguration/createClientAlertConfiguration.js.map +1 -0
  22. package/dist/repositories/clientAlertConfiguration/deleteClientAlertConfiguration.d.ts +4 -0
  23. package/dist/repositories/clientAlertConfiguration/deleteClientAlertConfiguration.js +25 -0
  24. package/dist/repositories/clientAlertConfiguration/deleteClientAlertConfiguration.js.map +1 -0
  25. package/dist/repositories/clientAlertConfiguration/getClientAlertConfigurations.d.ts +5 -0
  26. package/dist/repositories/clientAlertConfiguration/getClientAlertConfigurations.js +44 -0
  27. package/dist/repositories/clientAlertConfiguration/getClientAlertConfigurations.js.map +1 -0
  28. package/dist/repositories/clientAlertConfiguration/getClientAlertRecipients.d.ts +4 -0
  29. package/dist/repositories/clientAlertConfiguration/getClientAlertRecipients.js +40 -0
  30. package/dist/repositories/clientAlertConfiguration/getClientAlertRecipients.js.map +1 -0
  31. package/dist/repositories/clientAlertConfiguration/index.d.ts +11 -0
  32. package/dist/repositories/clientAlertConfiguration/index.js +53 -0
  33. package/dist/repositories/clientAlertConfiguration/index.js.map +1 -0
  34. package/dist/repositories/clientAlertConfiguration/setClientAlertRecipients.d.ts +4 -0
  35. package/dist/repositories/clientAlertConfiguration/setClientAlertRecipients.js +127 -0
  36. package/dist/repositories/clientAlertConfiguration/setClientAlertRecipients.js.map +1 -0
  37. package/dist/repositories/clientAlertConfiguration/updateClientAlertConfiguration.d.ts +4 -0
  38. package/dist/repositories/clientAlertConfiguration/updateClientAlertConfiguration.js +41 -0
  39. package/dist/repositories/clientAlertConfiguration/updateClientAlertConfiguration.js.map +1 -0
  40. package/dist/repositories/index.d.ts +2 -1
  41. package/dist/repositories/index.js +2 -1
  42. package/dist/repositories/index.js.map +1 -1
  43. package/dist/repositories/notificationRecipients/deleteNotificationRecipients.js +6 -1
  44. package/dist/repositories/notificationRecipients/deleteNotificationRecipients.js.map +1 -1
  45. package/dist/types/clientAlertConfiguration.d.ts +84 -0
  46. package/dist/types/clientAlertConfiguration.js +2 -0
  47. package/dist/types/clientAlertConfiguration.js.map +1 -0
  48. package/dist/types/index.d.ts +2 -1
  49. package/dist/types/index.js +2 -1
  50. package/dist/types/index.js.map +1 -1
  51. package/dist/types/notificationRecipients.d.ts +1 -0
  52. package/package.json +1 -1
@@ -0,0 +1,5 @@
1
+ import { ClientAlertConfiguration } from '../../entities';
2
+ import { NovaDataSource } from '../../novaDataSource';
3
+ import { CreateClientAlertConfigurationParams } from '../../types/clientAlertConfiguration';
4
+ import { Logger } from '../../types/logger';
5
+ export declare const createClientAlertConfiguration: (novaDataSource: NovaDataSource, params: CreateClientAlertConfigurationParams, logger: Logger) => Promise<ClientAlertConfiguration>;
@@ -0,0 +1,24 @@
1
+ import { ClientAlertConfiguration } from '../../entities';
2
+ export const createClientAlertConfiguration = async (novaDataSource, params, logger) => {
3
+ if (!params?.clientId || !params?.alertTypeId) {
4
+ logger.warn({ params }, 'ClientAlertConfigurationRepository::createClientAlertConfiguration - missing required parameters');
5
+ return null;
6
+ }
7
+ return novaDataSource.safeQuery(async (dataSource) => {
8
+ const clientAlertConfigurationsRepository = dataSource.getRepository(ClientAlertConfiguration);
9
+ const newClientAlertConfiguration = {
10
+ id: params.id,
11
+ clientId: params.clientId,
12
+ alertTypeId: params.alertTypeId,
13
+ name: params.name,
14
+ status: params.status || 'active',
15
+ alertValue: params.alertValue,
16
+ alertMetadata: params.alertMetadata,
17
+ filter: params.filter,
18
+ readOnly: params.readOnly || false,
19
+ };
20
+ const result = await clientAlertConfigurationsRepository.save(newClientAlertConfiguration);
21
+ return result;
22
+ }, 'ClientAlertConfigurationRepository::createClientAlertConfiguration');
23
+ };
24
+ //# sourceMappingURL=createClientAlertConfiguration.js.map
@@ -0,0 +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;QAC7C,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,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"}
@@ -0,0 +1,4 @@
1
+ import { NovaDataSource } from '../../novaDataSource';
2
+ import { DeleteClientAlertConfigurationsParams } from '../../types/clientAlertConfiguration';
3
+ import { Logger } from '../../types/logger';
4
+ export declare const deleteClientAlertConfigurations: (novaDataSource: NovaDataSource, params: DeleteClientAlertConfigurationsParams, logger: Logger) => Promise<boolean>;
@@ -0,0 +1,25 @@
1
+ import { ClientAlertConfiguration } from '../../entities';
2
+ export const deleteClientAlertConfigurations = async (novaDataSource, params, logger) => {
3
+ if (!params?.filters?.clientId || !params?.filters?.clientAlertConfigurationIds?.length) {
4
+ logger.warn({ params }, 'ClientAlertConfigurationRepository::deleteClientAlertConfiguration - missing required parameters');
5
+ return false;
6
+ }
7
+ return novaDataSource.safeQuery(async (dataSource) => {
8
+ const clientAlertConfigurationsRepository = dataSource.getRepository(ClientAlertConfiguration);
9
+ const queryBuilder = clientAlertConfigurationsRepository
10
+ .createQueryBuilder()
11
+ .update(ClientAlertConfiguration)
12
+ .set({
13
+ status: 'deleted',
14
+ })
15
+ .where('clientId = :clientId', {
16
+ clientId: params.filters.clientId,
17
+ })
18
+ .andWhere('id IN (:...clientAlertConfigurationIds)', {
19
+ clientAlertConfigurationIds: params.filters.clientAlertConfigurationIds,
20
+ });
21
+ const result = await queryBuilder.execute();
22
+ return result.affected > 0;
23
+ }, 'ClientAlertConfigurationRepository::deleteClientAlertConfiguration');
24
+ };
25
+ //# sourceMappingURL=deleteClientAlertConfiguration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deleteClientAlertConfiguration.js","sourceRoot":"","sources":["../../../src/repositories/clientAlertConfiguration/deleteClientAlertConfiguration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AAKzD,MAAM,CAAC,MAAM,+BAA+B,GAAG,KAAK,EAClD,cAA8B,EAC9B,MAA6C,EAC7C,MAAc,EACI,EAAE;IACpB,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,2BAA2B,EAAE,MAAM,EAAE;QACvF,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,MAAM,EAAE,SAAS;SAClB,CAAC;aACD,KAAK,CAAC,sBAAsB,EAAE;YAC7B,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,QAAQ;SAClC,CAAC;aACD,QAAQ,CAAC,yCAAyC,EAAE;YACnD,2BAA2B,EAAE,MAAM,CAAC,OAAO,CAAC,2BAA2B;SACxE,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,5 @@
1
+ import { ClientAlertConfiguration } from '../../entities';
2
+ import { NovaDataSource } from '../../novaDataSource';
3
+ import { GetClientAlertConfigurationsParams } from '../../types/clientAlertConfiguration';
4
+ import { Logger } from '../../types/logger';
5
+ export declare const getClientAlertConfigurations: (novaDataSource: NovaDataSource, params: GetClientAlertConfigurationsParams, logger: Logger) => Promise<ClientAlertConfiguration[]>;
@@ -0,0 +1,44 @@
1
+ import { ClientAlertConfiguration } from '../../entities';
2
+ export const getClientAlertConfigurations = async (novaDataSource, params, logger) => {
3
+ if (!params.filters.clientId) {
4
+ logger.warn({ params }, 'ClientAlertConfigurationRepository::getClientAlertConfigurations - missing required parameters');
5
+ return [];
6
+ }
7
+ // Force the query to run on master or slave
8
+ const dbQueryRunner = novaDataSource.createQueryRunnerFromParams(params);
9
+ return novaDataSource.safeQuery(async (dataSource, queryRunner) => {
10
+ const clientAlertConfigurationsRepository = dataSource.getRepository(ClientAlertConfiguration);
11
+ let queryBuilder = clientAlertConfigurationsRepository
12
+ .createQueryBuilder('clientAlertConfiguration')
13
+ .where('clientAlertConfiguration.clientId = :clientId', {
14
+ clientId: params.filters.clientId,
15
+ });
16
+ if (queryRunner) {
17
+ queryBuilder.setQueryRunner(queryRunner);
18
+ }
19
+ if (params.filters.alertTypeId) {
20
+ queryBuilder = queryBuilder.andWhere('clientAlertConfiguration.alertTypeId = :alertTypeId', {
21
+ alertTypeId: params.filters.alertTypeId,
22
+ });
23
+ }
24
+ if (params.filters.statusList) {
25
+ queryBuilder = queryBuilder.andWhere('clientAlertConfiguration.status IN (:...statusList)', {
26
+ statusList: params.filters.statusList,
27
+ });
28
+ }
29
+ if (params.filters.configurationIdList) {
30
+ queryBuilder = queryBuilder.andWhere('clientAlertConfiguration.id IN (:...configurationIdList)', {
31
+ configurationIdList: params.filters.configurationIdList,
32
+ });
33
+ }
34
+ if (params.projectionOptions?.withInternalRecipients) {
35
+ queryBuilder = queryBuilder.leftJoinAndSelect('clientAlertConfiguration.internalRecipients', 'internalRecipients');
36
+ }
37
+ if (params.projectionOptions?.withExternalRecipients) {
38
+ queryBuilder = queryBuilder.leftJoinAndSelect('clientAlertConfiguration.externalRecipients', 'externalRecipients');
39
+ }
40
+ const clientAlertConfigurations = await queryBuilder.getMany();
41
+ return clientAlertConfigurations;
42
+ }, 'ClientAlertConfigurationRepository::getClientAlertConfigurations', dbQueryRunner);
43
+ };
44
+ //# sourceMappingURL=getClientAlertConfigurations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getClientAlertConfigurations.js","sourceRoot":"","sources":["../../../src/repositories/clientAlertConfiguration/getClientAlertConfigurations.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AAKzD,MAAM,CAAC,MAAM,4BAA4B,GAAG,KAAK,EAC/C,cAA8B,EAC9B,MAA0C,EAC1C,MAAc,EACuB,EAAE;IACvC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE;QAC5B,MAAM,CAAC,IAAI,CACT,EAAE,MAAM,EAAE,EACV,gGAAgG,CACjG,CAAA;QACD,OAAO,EAAE,CAAA;KACV;IAED,4CAA4C;IAC5C,MAAM,aAAa,GAAG,cAAc,CAAC,2BAA2B,CAAC,MAAM,CAAC,CAAA;IAExE,OAAO,cAAc,CAAC,SAAS,CAC7B,KAAK,EACH,UAA0B,EAC1B,WAAyB,EACY,EAAE;QACvC,MAAM,mCAAmC,GAAG,UAAU,CAAC,aAAa,CAAC,wBAAwB,CAAC,CAAA;QAE9F,IAAI,YAAY,GAAG,mCAAmC;aACnD,kBAAkB,CAAC,0BAA0B,CAAC;aAC9C,KAAK,CAAC,+CAA+C,EAAE;YACtD,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,QAAQ;SAClC,CAAC,CAAA;QAEJ,IAAI,WAAW,EAAE;YACf,YAAY,CAAC,cAAc,CAAC,WAAW,CAAC,CAAA;SACzC;QAED,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE;YAC9B,YAAY,GAAG,YAAY,CAAC,QAAQ,CAClC,qDAAqD,EACrD;gBACE,WAAW,EAAE,MAAM,CAAC,OAAO,CAAC,WAAW;aACxC,CACF,CAAA;SACF;QAED,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE;YAC7B,YAAY,GAAG,YAAY,CAAC,QAAQ,CAClC,qDAAqD,EACrD;gBACE,UAAU,EAAE,MAAM,CAAC,OAAO,CAAC,UAAU;aACtC,CACF,CAAA;SACF;QAED,IAAI,MAAM,CAAC,OAAO,CAAC,mBAAmB,EAAE;YACtC,YAAY,GAAG,YAAY,CAAC,QAAQ,CAClC,0DAA0D,EAC1D;gBACE,mBAAmB,EAAE,MAAM,CAAC,OAAO,CAAC,mBAAmB;aACxD,CACF,CAAA;SACF;QAED,IAAI,MAAM,CAAC,iBAAiB,EAAE,sBAAsB,EAAE;YACpD,YAAY,GAAG,YAAY,CAAC,iBAAiB,CAC3C,6CAA6C,EAC7C,oBAAoB,CACrB,CAAA;SACF;QAED,IAAI,MAAM,CAAC,iBAAiB,EAAE,sBAAsB,EAAE;YACpD,YAAY,GAAG,YAAY,CAAC,iBAAiB,CAC3C,6CAA6C,EAC7C,oBAAoB,CACrB,CAAA;SACF;QAED,MAAM,yBAAyB,GAAG,MAAM,YAAY,CAAC,OAAO,EAAE,CAAA;QAE9D,OAAO,yBAAyB,CAAA;IAClC,CAAC,EACD,kEAAkE,EAClE,aAAa,CACd,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { NovaDataSource } from '../../novaDataSource';
2
+ import { GetClientAlertRecipientsParams, GetClientAlertRecipientsResult } from '../../types/clientAlertConfiguration';
3
+ import { Logger } from '../../types/logger';
4
+ export declare const getClientAlertRecipients: (novaDataSource: NovaDataSource, params: GetClientAlertRecipientsParams, logger: Logger) => Promise<GetClientAlertRecipientsResult>;
@@ -0,0 +1,40 @@
1
+ import { ClientAlertConfiguration, ClientAlertRecipient, NotificationRecipient, } from '../../entities';
2
+ export const getClientAlertRecipients = async (novaDataSource, params, logger) => {
3
+ if (!params.filters.clientId || !params.filters.clientAlertConfigurationId) {
4
+ logger.warn({ params }, 'ClientAlertConfigurationRepository::getClientAlertRecipients - missing required parameters');
5
+ return null;
6
+ }
7
+ // Force the query to run on master or slave
8
+ const dbQueryRunner = novaDataSource.createQueryRunnerFromParams(params);
9
+ return novaDataSource.safeQuery(async (dataSource, queryRunner) => {
10
+ const result = {
11
+ internalRecipients: [],
12
+ externalRecipients: [],
13
+ };
14
+ const clientAlertRecipientsRepository = dataSource.getRepository(ClientAlertRecipient);
15
+ const queryBuilder = clientAlertRecipientsRepository
16
+ .createQueryBuilder('clientAlertRecipient')
17
+ .innerJoin(ClientAlertConfiguration, 'clientAlertConfiguration', 'clientAlertConfiguration.id = clientAlertRecipient.clientAlertConfigurationId')
18
+ .where('clientAlertConfiguration.clientId = :clientId', {
19
+ clientId: params.filters.clientId,
20
+ })
21
+ .andWhere('clientAlertConfiguration.id = :clientAlertConfigurationId', {
22
+ clientAlertConfigurationId: params.filters.clientAlertConfigurationId,
23
+ });
24
+ if (queryRunner) {
25
+ queryBuilder.setQueryRunner(queryRunner);
26
+ }
27
+ const clientAlertRecipients = await queryBuilder.getMany();
28
+ result.internalRecipients = clientAlertRecipients;
29
+ const notificationRecipientsRepository = dataSource.getRepository(NotificationRecipient);
30
+ const notificationRecipients = await notificationRecipientsRepository.find({
31
+ where: {
32
+ clientId: params.filters.clientId,
33
+ clientAlertConfigurationId: params.filters.clientAlertConfigurationId,
34
+ },
35
+ });
36
+ result.externalRecipients = notificationRecipients;
37
+ return result;
38
+ }, 'ClientAlertConfigurationRepository::getClientAlertRecipients', dbQueryRunner);
39
+ };
40
+ //# sourceMappingURL=getClientAlertRecipients.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getClientAlertRecipients.js","sourceRoot":"","sources":["../../../src/repositories/clientAlertConfiguration/getClientAlertRecipients.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,gBAAgB,CAAA;AAQvB,MAAM,CAAC,MAAM,wBAAwB,GAAG,KAAK,EAC3C,cAA8B,EAC9B,MAAsC,EACtC,MAAc,EAC2B,EAAE;IAC3C,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,0BAA0B,EAAE;QAC1E,MAAM,CAAC,IAAI,CACT,EAAE,MAAM,EAAE,EACV,4FAA4F,CAC7F,CAAA;QACD,OAAO,IAAI,CAAA;KACZ;IAED,4CAA4C;IAC5C,MAAM,aAAa,GAAG,cAAc,CAAC,2BAA2B,CAAC,MAAM,CAAC,CAAA;IAExE,OAAO,cAAc,CAAC,SAAS,CAC7B,KAAK,EACH,UAA0B,EAC1B,WAAyB,EACgB,EAAE;QAC3C,MAAM,MAAM,GAAG;YACb,kBAAkB,EAAE,EAAE;YACtB,kBAAkB,EAAE,EAAE;SACvB,CAAA;QAED,MAAM,+BAA+B,GAAG,UAAU,CAAC,aAAa,CAAC,oBAAoB,CAAC,CAAA;QAEtF,MAAM,YAAY,GAAG,+BAA+B;aACjD,kBAAkB,CAAC,sBAAsB,CAAC;aAC1C,SAAS,CACR,wBAAwB,EACxB,0BAA0B,EAC1B,+EAA+E,CAChF;aACA,KAAK,CAAC,+CAA+C,EAAE;YACtD,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,QAAQ;SAClC,CAAC;aACD,QAAQ,CAAC,2DAA2D,EAAE;YACrE,0BAA0B,EAAE,MAAM,CAAC,OAAO,CAAC,0BAA0B;SACtE,CAAC,CAAA;QAEJ,IAAI,WAAW,EAAE;YACf,YAAY,CAAC,cAAc,CAAC,WAAW,CAAC,CAAA;SACzC;QAED,MAAM,qBAAqB,GAAG,MAAM,YAAY,CAAC,OAAO,EAAE,CAAA;QAE1D,MAAM,CAAC,kBAAkB,GAAG,qBAAqB,CAAA;QAEjD,MAAM,gCAAgC,GAAG,UAAU,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAA;QAExF,MAAM,sBAAsB,GAAG,MAAM,gCAAgC,CAAC,IAAI,CAAC;YACzE,KAAK,EAAE;gBACL,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,QAAQ;gBACjC,0BAA0B,EAAE,MAAM,CAAC,OAAO,CAAC,0BAA0B;aACtE;SACF,CAAC,CAAA;QAEF,MAAM,CAAC,kBAAkB,GAAG,sBAAsB,CAAA;QAElD,OAAO,MAAM,CAAA;IACf,CAAC,EACD,8DAA8D,EAC9D,aAAa,CACd,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,11 @@
1
+ import { ClientAlertConfiguration } from '../../entities';
2
+ import { CreateClientAlertConfigurationParams, DeleteClientAlertConfigurationsParams, GetClientAlertConfigurationsParams, GetClientAlertRecipientsParams, GetClientAlertRecipientsResult, SetClientAlertRecipientsParams, UpdateClientAlertConfigurationParams } from '../../types/clientAlertConfiguration';
3
+ import { BaseRepository } from '../baseRepository';
4
+ export declare class ClientAlertConfigurationRepository extends BaseRepository {
5
+ getClientAlertConfigurations(params: GetClientAlertConfigurationsParams): Promise<ClientAlertConfiguration[]>;
6
+ createClientAlertConfiguration(params: CreateClientAlertConfigurationParams): Promise<ClientAlertConfiguration>;
7
+ updateClientAlertConfiguration(params: UpdateClientAlertConfigurationParams): Promise<boolean>;
8
+ deleteClientAlertConfigurations(params: DeleteClientAlertConfigurationsParams): Promise<boolean>;
9
+ getClientAlertRecipients(params: GetClientAlertRecipientsParams): Promise<GetClientAlertRecipientsResult>;
10
+ setClientAlertRecipients(params: SetClientAlertRecipientsParams): Promise<boolean>;
11
+ }
@@ -0,0 +1,53 @@
1
+ import { NovaDataSource } from '../../novaDataSource';
2
+ import { BaseRepository } from '../baseRepository';
3
+ import { createClientAlertConfiguration } from './createClientAlertConfiguration';
4
+ import { deleteClientAlertConfigurations } from './deleteClientAlertConfiguration';
5
+ import { getClientAlertConfigurations } from './getClientAlertConfigurations';
6
+ import { getClientAlertRecipients } from './getClientAlertRecipients';
7
+ import { setClientAlertRecipients } from './setClientAlertRecipients';
8
+ import { updateClientAlertConfiguration } from './updateClientAlertConfiguration';
9
+ export class ClientAlertConfigurationRepository extends BaseRepository {
10
+ async getClientAlertConfigurations(params) {
11
+ this.logger.trace(params, 'ClientAlertConfigurationRepository::getClientAlertConfigurations started with params');
12
+ const novaDataSource = new NovaDataSource(this.novaDataSourceConfig, this.logger, this.replicaNovaDataSourceConfig);
13
+ const result = await getClientAlertConfigurations(novaDataSource, params, this.logger);
14
+ this.logger.trace(result, 'ClientAlertConfigurationRepository::getClientAlertConfigurations result');
15
+ return result;
16
+ }
17
+ async createClientAlertConfiguration(params) {
18
+ this.logger.trace(params, 'ClientAlertConfigurationRepository::createClientAlertConfiguration started with params');
19
+ const novaDataSource = new NovaDataSource(this.novaDataSourceConfig, this.logger, this.replicaNovaDataSourceConfig);
20
+ const result = await createClientAlertConfiguration(novaDataSource, params, this.logger);
21
+ this.logger.trace(result, 'ClientAlertConfigurationRepository::createClientAlertConfiguration result');
22
+ return result;
23
+ }
24
+ async updateClientAlertConfiguration(params) {
25
+ this.logger.trace(params, 'ClientAlertConfigurationRepository::updateClientAlertConfiguration started with params');
26
+ const novaDataSource = new NovaDataSource(this.novaDataSourceConfig, this.logger, this.replicaNovaDataSourceConfig);
27
+ const result = await updateClientAlertConfiguration(novaDataSource, params, this.logger);
28
+ this.logger.trace({ result }, 'ClientAlertConfigurationRepository::updateClientAlertConfiguration result');
29
+ return result;
30
+ }
31
+ async deleteClientAlertConfigurations(params) {
32
+ this.logger.trace(params, 'ClientAlertConfigurationRepository::deleteClientAlertConfigurations started with params');
33
+ const novaDataSource = new NovaDataSource(this.novaDataSourceConfig, this.logger, this.replicaNovaDataSourceConfig);
34
+ const result = await deleteClientAlertConfigurations(novaDataSource, params, this.logger);
35
+ this.logger.trace({ result }, 'ClientAlertConfigurationRepository::deleteClientAlertConfigurations result');
36
+ return result;
37
+ }
38
+ async getClientAlertRecipients(params) {
39
+ this.logger.trace(params, 'ClientAlertConfigurationRepository::getClientAlertRecipients started with params');
40
+ const novaDataSource = new NovaDataSource(this.novaDataSourceConfig, this.logger, this.replicaNovaDataSourceConfig);
41
+ const result = await getClientAlertRecipients(novaDataSource, params, this.logger);
42
+ this.logger.trace(result, 'ClientAlertConfigurationRepository::getClientAlertRecipients result');
43
+ return result;
44
+ }
45
+ async setClientAlertRecipients(params) {
46
+ this.logger.trace(params, 'ClientAlertConfigurationRepository::setClientAlertRecipients started with params');
47
+ const novaDataSource = new NovaDataSource(this.novaDataSourceConfig, this.logger, this.replicaNovaDataSourceConfig);
48
+ const result = await setClientAlertRecipients(novaDataSource, params, this.logger);
49
+ this.logger.trace({ result }, 'ClientAlertConfigurationRepository::setClientAlertRecipients result');
50
+ return result;
51
+ }
52
+ }
53
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/repositories/clientAlertConfiguration/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAUrD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAA;AACjF,OAAO,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAA;AAClF,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAA;AAC7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AACrE,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAA;AAEjF,MAAM,OAAO,kCA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A2B,CACjC,CAAA;QAED,MAAM,MAAM,GAAG,MAAM,wBAAwB,CAAC,cAAc,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;QAElF,IAAI,CAAC,MAAM,CAAC,KAAK,CACf,EAAE,MAAM,EAAE,EACV,qEAAqE,CACtE,CAAA;QAED,OAAO,MAAM,CAAA;IACf,CAAC;CACF"}
@@ -0,0 +1,4 @@
1
+ import { NovaDataSource } from '../../novaDataSource';
2
+ import { SetClientAlertRecipientsParams } from '../../types/clientAlertConfiguration';
3
+ import { Logger } from '../../types/logger';
4
+ export declare const setClientAlertRecipients: (novaDataSource: NovaDataSource, params: SetClientAlertRecipientsParams, logger: Logger) => Promise<boolean>;
@@ -0,0 +1,127 @@
1
+ import { ClientAlertConfiguration, ClientAlertRecipient, NotificationRecipient, } from '../../entities';
2
+ import { uuidStringToBinaryBuffer } from '../../utils/uuidHelpers';
3
+ export const setClientAlertRecipients = async (novaDataSource, params, logger) => {
4
+ if (!params?.filters?.clientId || !params?.filters?.clientAlertConfigurationId) {
5
+ logger.error('ClientAlertConfigurationRepository::setClientAlertRecipients - missing required parameters');
6
+ return false;
7
+ }
8
+ return novaDataSource.safeQuery(async (dataSource) => {
9
+ const clientAlertConfigurationsRepository = dataSource.getRepository(ClientAlertConfiguration);
10
+ const existentClientAlertConfiguration = await clientAlertConfigurationsRepository.findOne({
11
+ where: { id: params.filters.clientAlertConfigurationId, clientId: params.filters.clientId },
12
+ });
13
+ if (!existentClientAlertConfiguration) {
14
+ return false;
15
+ }
16
+ const setInternalRecipientsResult = await setInternalRecipients(dataSource, params.filters.clientAlertConfigurationId, params.values.globalAccountConfig, params.values.userIdRecipients, params.values.roleIdRecipients);
17
+ if (!setInternalRecipientsResult) {
18
+ return false;
19
+ }
20
+ const setNotificationRecipientsResult = await setNotificationRecipients(dataSource, params.filters.clientAlertConfigurationId, params.filters.clientId, params.values.externalRecipients);
21
+ return setNotificationRecipientsResult;
22
+ }, 'ClientAlertConfigurationRepository::setClientAlertRecipients');
23
+ };
24
+ const setInternalRecipients = async (dataSource, clientAlertConfigurationId, globalAccountConfig, userIdRecipients, roleIdRecipients) => {
25
+ const clientAlertRecipientsRepository = dataSource.getRepository(ClientAlertRecipient);
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
37
+ ? [
38
+ {
39
+ id: null,
40
+ clientAlertConfigurationId,
41
+ userId: null,
42
+ roleId: null,
43
+ isEnabled: true,
44
+ appNotification: globalAccountConfig.appNotification ?? false,
45
+ emailNotification: globalAccountConfig.emailNotification ?? false,
46
+ pushNotification: globalAccountConfig.pushNotification ?? false,
47
+ smsNotification: globalAccountConfig.smsNotification ?? false,
48
+ },
49
+ ]
50
+ : [];
51
+ const roleRecipients = roleIdRecipients?.map(roleRecipient => ({
52
+ id: null,
53
+ clientAlertConfigurationId,
54
+ userId: null,
55
+ roleId: roleRecipient.roleId,
56
+ isEnabled: roleRecipient.isEnabled,
57
+ appNotification: roleRecipient.appNotification ?? false,
58
+ emailNotification: roleRecipient.emailNotification ?? false,
59
+ pushNotification: roleRecipient.pushNotification ?? false,
60
+ smsNotification: roleRecipient.smsNotification ?? false,
61
+ includeAllUsers: false,
62
+ })) ?? [];
63
+ clientAlertRecipients.push(...roleRecipients);
64
+ const userRecipients = userIdRecipients?.map(userRecipient => ({
65
+ id: null,
66
+ clientAlertConfigurationId,
67
+ userId: uuidStringToBinaryBuffer(userRecipient.userId),
68
+ roleId: null,
69
+ isEnabled: userRecipient.isEnabled,
70
+ appNotification: userRecipient.appNotification ?? false,
71
+ emailNotification: userRecipient.emailNotification ?? false,
72
+ pushNotification: userRecipient.pushNotification ?? false,
73
+ smsNotification: userRecipient.smsNotification ?? false,
74
+ includeAllUsers: false,
75
+ })) ?? [];
76
+ clientAlertRecipients.push(...userRecipients);
77
+ const maxItemsPerQuery = 50;
78
+ const partitionedItems = [];
79
+ // We split the in groups of 50 to avoid having a query with too many items to insert
80
+ for (let i = 0; i < clientAlertRecipients.length; i += maxItemsPerQuery) {
81
+ partitionedItems.push(clientAlertRecipients.slice(i, i + maxItemsPerQuery));
82
+ }
83
+ for (const recipients of partitionedItems) {
84
+ const result = await clientAlertRecipientsRepository.insert(recipients);
85
+ if (!result?.raw?.affectedRows) {
86
+ return false;
87
+ }
88
+ }
89
+ return true;
90
+ };
91
+ const setNotificationRecipients = async (dataSource, clientAlertConfigurationId, clientId, externalRecipients) => {
92
+ const notificationRecipientsRepository = dataSource.getRepository(NotificationRecipient);
93
+ await notificationRecipientsRepository
94
+ .createQueryBuilder()
95
+ .delete()
96
+ .where('clientAlertConfigurationId = :clientAlertConfigurationId', {
97
+ clientAlertConfigurationId: clientAlertConfigurationId,
98
+ })
99
+ .execute();
100
+ if (!externalRecipients?.length) {
101
+ return true;
102
+ }
103
+ const now = new Date();
104
+ const notificationRecipients = externalRecipients?.map(recipient => ({
105
+ clientAlertConfigurationId,
106
+ clientId,
107
+ isEnabled: true,
108
+ isUserProfile: false,
109
+ notificationType: recipient.type === 'email' ? 1 : 2,
110
+ recipient: recipient.recipient,
111
+ createdAt: now,
112
+ }));
113
+ const maxItemsPerQuery = 50;
114
+ const partitionedItems = [];
115
+ // We split the users in groups of 50 to avoid having a query with too many items to insert
116
+ for (let i = 0; i < notificationRecipients.length; i += maxItemsPerQuery) {
117
+ partitionedItems.push(notificationRecipients.slice(i, i + maxItemsPerQuery));
118
+ }
119
+ for (const partitionedRecipients of partitionedItems) {
120
+ const result = await notificationRecipientsRepository.insert(partitionedRecipients);
121
+ if (!result?.raw?.affectedRows) {
122
+ return false;
123
+ }
124
+ }
125
+ return true;
126
+ };
127
+ //# sourceMappingURL=setClientAlertRecipients.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setClientAlertRecipients.js","sourceRoot":"","sources":["../../../src/repositories/clientAlertConfiguration/setClientAlertRecipients.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,gBAAgB,CAAA;AAUvB,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAA;AAElE,MAAM,CAAC,MAAM,wBAAwB,GAAG,KAAK,EAC3C,cAA8B,EAC9B,MAAsC,EACtC,MAAc,EACI,EAAE;IACpB,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,0BAA0B,EAAE;QAC9E,MAAM,CAAC,KAAK,CACV,4FAA4F,CAC7F,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,gCAAgC,GAAG,MAAM,mCAAmC,CAAC,OAAO,CAAC;YACzF,KAAK,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,OAAO,CAAC,0BAA0B,EAAE,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE;SAC5F,CAAC,CAAA;QAEF,IAAI,CAAC,gCAAgC,EAAE;YACrC,OAAO,KAAK,CAAA;SACb;QAED,MAAM,2BAA2B,GAAG,MAAM,qBAAqB,CAC7D,UAAU,EACV,MAAM,CAAC,OAAO,CAAC,0BAA0B,EACzC,MAAM,CAAC,MAAM,CAAC,mBAAmB,EACjC,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAC9B,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAC/B,CAAA;QAED,IAAI,CAAC,2BAA2B,EAAE;YAChC,OAAO,KAAK,CAAA;SACb;QAED,MAAM,+BA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AC3F,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,sBAAsB,CAAC,MAAM,EAAE,CAAC,IAAI,gBAAgB,EAAE;QACxE,gBAAgB,CAAC,IAAI,CACnB,sBAAsB,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,gBAAgB,CAA4B,CACjF,CAAA;KACF;IAED,KAAK,MAAM,qBAAqB,IAAI,gBAAgB,EAAE;QACpD,MAAM,MAAM,GAAG,MAAM,gCAAgC,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAA;QAEnF,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE;YAC9B,OAAO,KAAK,CAAA;SACb;KACF;IAED,OAAO,IAAI,CAAA;AACb,CAAC,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { NovaDataSource } from '../../novaDataSource';
2
+ import { UpdateClientAlertConfigurationParams } from '../../types/clientAlertConfiguration';
3
+ import { Logger } from '../../types/logger';
4
+ export declare const updateClientAlertConfiguration: (novaDataSource: NovaDataSource, params: UpdateClientAlertConfigurationParams, logger: Logger) => Promise<boolean>;
@@ -0,0 +1,41 @@
1
+ import { ClientAlertConfiguration } from '../../entities';
2
+ export const updateClientAlertConfiguration = async (novaDataSource, params, logger) => {
3
+ // userId filter is required
4
+ if (!params?.filters?.clientId && !params?.filters?.clientAlertConfigurationId) {
5
+ logger.warn({ params }, 'ClientAlertConfigurationRepository::updateClientAlertConfiguration - missing required parameters');
6
+ return false;
7
+ }
8
+ // at least one field to update is required
9
+ if (!params?.values?.status &&
10
+ !params?.values?.alertValue &&
11
+ !params?.values?.alertMetadata &&
12
+ !params?.values?.filter &&
13
+ !params?.values?.name &&
14
+ params?.values?.readOnly == null) {
15
+ logger.warn({ params }, 'ClientAlertConfigurationRepository::updateClientAlertConfiguration - missing required parameters');
16
+ return false;
17
+ }
18
+ return novaDataSource.safeQuery(async (dataSource) => {
19
+ const clientAlertConfigurationsRepository = dataSource.getRepository(ClientAlertConfiguration);
20
+ const queryBuilder = clientAlertConfigurationsRepository
21
+ .createQueryBuilder()
22
+ .update(ClientAlertConfiguration)
23
+ .set({
24
+ alertValue: params?.values?.alertValue,
25
+ alertMetadata: params?.values?.alertMetadata,
26
+ readOnly: params?.values?.readOnly,
27
+ filter: params?.values?.filter,
28
+ name: params?.values?.name,
29
+ status: params?.values?.status,
30
+ })
31
+ .where('clientId = :clientId', {
32
+ clientId: params.filters.clientId,
33
+ })
34
+ .andWhere('id = :clientAlertConfigurationId', {
35
+ clientAlertConfigurationId: params.filters.clientAlertConfigurationId,
36
+ });
37
+ const result = await queryBuilder.execute();
38
+ return result.affected > 0;
39
+ }, 'ClientAlertConfigurationRepository::updateClientAlertConfiguration');
40
+ };
41
+ //# sourceMappingURL=updateClientAlertConfiguration.js.map
@@ -0,0 +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,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,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,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"}
@@ -9,6 +9,7 @@ import { BlacklistRepository } from './blacklist';
9
9
  import { BLEMeshRepository } from './bleMesh';
10
10
  import { BLEMeshConfigurationRepository } from './bleMeshConfiguration';
11
11
  import { BoundariesRepository } from './boundaries';
12
+ import { ClientAlertConfigurationRepository } from './clientAlertConfiguration';
12
13
  import { ClientsRepository } from './clients';
13
14
  import { CountriesRepository } from './countries';
14
15
  import { DataExportsRepository } from './dataExports';
@@ -39,4 +40,4 @@ import { UserInvitationsRepository } from './userInvitations';
39
40
  import { UserRatingRequestsRepository } from './userRatingRequests';
40
41
  import { UserRegistrationAttemptsRepository } from './userRegistrationAttempts';
41
42
  import { UsersRepository } from './users';
42
- export { AcumaticaRepository, AempTokenRepository, AlertRepository, AlertTypesRepository, AppFeaturesRepository, AssetCategoriesRepository, BillingRepository, BlacklistRepository, BLEMeshRepository, BLEMeshConfigurationRepository, BoundariesRepository, ClientsRepository, CountriesRepository, DataExportsRepository, DeactivationsRepository, DeviceStatusRepository, DeviceBehaviorsRepository, DevicePairingsRepository, DevicesRepository, DeviceTypeFeatureRepository, EntityTagsRepository, FeatureRepository, FirmwaresRepository, LatestUserAppInfoRepository, LiveLinksRepository, NotificationRecipientsRepository, PositionRepository, PromotionRepository, SecurityRepository, TagsRepository, TasksRepository, TripRepository, UserActivationsRepository, UserAppFeedbackRepository, UserAppIncidentsRepository, UserConfigurationsRepository, UserDataDeletionRequestsRepository, UserInvitationsRepository, UserRatingRequestsRepository, UserRegistrationAttemptsRepository, UsersRepository, };
43
+ export { AcumaticaRepository, AempTokenRepository, AlertRepository, AlertTypesRepository, AppFeaturesRepository, AssetCategoriesRepository, BillingRepository, BlacklistRepository, BLEMeshRepository, BLEMeshConfigurationRepository, BoundariesRepository, ClientAlertConfigurationRepository, ClientsRepository, CountriesRepository, DataExportsRepository, DeactivationsRepository, DeviceStatusRepository, DeviceBehaviorsRepository, DevicePairingsRepository, DevicesRepository, DeviceTypeFeatureRepository, EntityTagsRepository, FeatureRepository, FirmwaresRepository, LatestUserAppInfoRepository, LiveLinksRepository, NotificationRecipientsRepository, PositionRepository, PromotionRepository, SecurityRepository, TagsRepository, TasksRepository, TripRepository, UserActivationsRepository, UserAppFeedbackRepository, UserAppIncidentsRepository, UserConfigurationsRepository, UserDataDeletionRequestsRepository, UserInvitationsRepository, UserRatingRequestsRepository, UserRegistrationAttemptsRepository, UsersRepository, };
@@ -9,6 +9,7 @@ import { BlacklistRepository } from './blacklist';
9
9
  import { BLEMeshRepository } from './bleMesh';
10
10
  import { BLEMeshConfigurationRepository } from './bleMeshConfiguration';
11
11
  import { BoundariesRepository } from './boundaries';
12
+ import { ClientAlertConfigurationRepository } from './clientAlertConfiguration';
12
13
  import { ClientsRepository } from './clients';
13
14
  import { CountriesRepository } from './countries';
14
15
  import { DataExportsRepository } from './dataExports';
@@ -39,5 +40,5 @@ import { UserInvitationsRepository } from './userInvitations';
39
40
  import { UserRatingRequestsRepository } from './userRatingRequests';
40
41
  import { UserRegistrationAttemptsRepository } from './userRegistrationAttempts';
41
42
  import { UsersRepository } from './users';
42
- export { AcumaticaRepository, AempTokenRepository, AlertRepository, AlertTypesRepository, AppFeaturesRepository, AssetCategoriesRepository, BillingRepository, BlacklistRepository, BLEMeshRepository, BLEMeshConfigurationRepository, BoundariesRepository, ClientsRepository, CountriesRepository, DataExportsRepository, DeactivationsRepository, DeviceStatusRepository, DeviceBehaviorsRepository, DevicePairingsRepository, DevicesRepository, DeviceTypeFeatureRepository, EntityTagsRepository, FeatureRepository, FirmwaresRepository, LatestUserAppInfoRepository, LiveLinksRepository, NotificationRecipientsRepository, PositionRepository, PromotionRepository, SecurityRepository, TagsRepository, TasksRepository, TripRepository, UserActivationsRepository, UserAppFeedbackRepository, UserAppIncidentsRepository, UserConfigurationsRepository, UserDataDeletionRequestsRepository, UserInvitationsRepository, UserRatingRequestsRepository, UserRegistrationAttemptsRepository, UsersRepository, };
43
+ export { AcumaticaRepository, AempTokenRepository, AlertRepository, AlertTypesRepository, AppFeaturesRepository, AssetCategoriesRepository, BillingRepository, BlacklistRepository, BLEMeshRepository, BLEMeshConfigurationRepository, BoundariesRepository, ClientAlertConfigurationRepository, ClientsRepository, CountriesRepository, DataExportsRepository, DeactivationsRepository, DeviceStatusRepository, DeviceBehaviorsRepository, DevicePairingsRepository, DevicesRepository, DeviceTypeFeatureRepository, EntityTagsRepository, FeatureRepository, FirmwaresRepository, LatestUserAppInfoRepository, LiveLinksRepository, NotificationRecipientsRepository, PositionRepository, PromotionRepository, SecurityRepository, TagsRepository, TasksRepository, TripRepository, UserActivationsRepository, UserAppFeedbackRepository, UserAppIncidentsRepository, UserConfigurationsRepository, UserDataDeletionRequestsRepository, UserInvitationsRepository, UserRatingRequestsRepository, UserRegistrationAttemptsRepository, UsersRepository, };
43
44
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/repositories/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAA;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAA;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAA;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AAM,4BAA4B,CAAA;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAEzC,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,yBAAyB,EACzB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,8BAA8B,EAC9B,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,EACzB,wBAAwB,EACxB,iBAAiB,EACjB,2BAA2B,EAC3B,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,2BAA2B,EAC3B,mBAAmB,EACnB,gCAAgC,EAChC,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,cAAc,EACd,yBAAyB,EACzB,yBAAyB,EACzB,0BAA0B,EAC1B,4BAA4B,EAC5B,kCAAkC,EAClC,yBAAyB,EACzB,4BAA4B,EAC5B,kCAAkC,EAClC,eAAe,GAChB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/repositories/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAA;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAE,8BAA8B,E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AyB,EAAE,MAAM,mBAAmB,CAAA;AAC7D,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAA;AAC7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAA;AAC/D,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAA;AACnE,OAAO,EAAE,kCAAkC,EAAE,MAAM,4BAA4B,CAAA;AAC/E,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAA;AAC7D,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAA;AACnE,OAAO,EAAE,kCAAkC,EAAE,MAAM,4BAA4B,CAAA;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAEzC,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,yBAAyB,EACzB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,8BAA8B,EAC9B,oBAAoB,EACpB,kCAAkC,EAClC,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,EACzB,wBAAwB,EACxB,iBAAiB,EACjB,2BAA2B,EAC3B,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,2BAA2B,EAC3B,mBAAmB,EACnB,gCAAgC,EAChC,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,cAAc,EACd,yBAAyB,EACzB,yBAAyB,EACzB,0BAA0B,EAC1B,4BAA4B,EAC5B,kCAAkC,EAClC,yBAAyB,EACzB,4BAA4B,EAC5B,kCAAkC,EAClC,eAAe,GAChB,CAAA"}
@@ -2,7 +2,9 @@ import { NotificationRecipient } from '../../entities';
2
2
  import { uuidStringToBinaryBuffer } from '../../utils/uuidHelpers';
3
3
  export const deleteNotificationRecipients = async (novaDataSource, params, logger) => {
4
4
  // filter is required
5
- if (!params?.filters?.id && !params?.filters?.userId) {
5
+ if (!params?.filters?.id &&
6
+ !params?.filters?.userId &&
7
+ !params?.filters?.clientAlertConfigurationId) {
6
8
  logger.warn({ params }, 'NotificationRecipientsRepository::deleteNotificationRecipients - missing required parameters');
7
9
  return false;
8
10
  }
@@ -20,6 +22,9 @@ export const deleteNotificationRecipients = async (novaDataSource, params, logge
20
22
  if (params?.filters?.userId) {
21
23
  queryBuilder = queryBuilder.andWhere('userId = :userId', { userId: userIdBinaryBuffer });
22
24
  }
25
+ if (params?.filters?.clientAlertConfigurationId) {
26
+ queryBuilder = queryBuilder.andWhere('clientAlertConfigurationId = :clientAlertConfigurationId', { clientAlertConfigurationId: params?.filters?.clientAlertConfigurationId });
27
+ }
23
28
  const result = await queryBuilder.execute();
24
29
  return result.affected > 0;
25
30
  }, 'NotificationRecipientsRepository::deleteNotificationRecipients');
@@ -1 +1 @@
1
- {"version":3,"file":"deleteNotificationRecipients.js","sourceRoot":"","sources":["../../../src/repositories/notificationRecipients/deleteNotificationRecipients.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AAItD,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAA;AAElE,MAAM,CAAC,MAAM,4BAA4B,GAAG,KAAK,EAC/C,cAA8B,EAC9B,MAA0C,EAC1C,MAAc,EACI,EAAE;IACpB,qBAAqB;IACrB,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE;QACpD,MAAM,CAAC,IAAI,CACT,EAAE,MAAM,EAAE,EACV,8FAA8F,CAC/F,CAAA;QACD,OAAO,KAAK,CAAA;KACb;IAED,MAAM,kBAAkB,GAAG,wBAAwB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;IAC5E,IAAI,MAAM,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC,kBAAkB,EAAE;QAClD,MAAM,CAAC,IAAI,CACT,EAAE,MAAM,EAAE,EACV,6FAA6F,CAC9F,CAAA;QACD,OAAO,KAAK,CAAA;KACb;IAED,OAAO,cAAc,CAAC,SAAS,CAAC,KAAK,EAAE,UAA0B,EAAoB,EAAE;QACrF,MAAM,sCAAsC,GAAG,UAAU,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAA;QAE9F,IAAI,YAAY,GAAG,sCAAsC,CAAC,kBAAkB,EAAE,CAAC,MAAM,EAAE,CAAA;QAEvF,IAAI,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE;YACvB,YAAY,GAAG,YAAY,CAAC,QAAQ,CAAC,UAAU,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAA;SAC9E;QAED,IAAI,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE;YAC3B,YAAY,GAAG,YAAY,CAAC,QAAQ,CAAC,kBAAkB,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAC,CAAA;SACzF;QAED,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,OAAO,EAAE,CAAA;QAE3C,OAAO,MAAM,CAAC,QAAQ,GAAG,CAAC,CAAA;IAC5B,CAAC,EAAE,gEAAgE,CAAC,CAAA;AACtE,CAAC,CAAA"}
1
+ {"version":3,"file":"deleteNotificationRecipients.js","sourceRoot":"","sources":["../../../src/repositories/notificationRecipients/deleteNotificationRecipients.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AAItD,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAA;AAElE,MAAM,CAAC,MAAM,4BAA4B,GAAG,KAAK,EAC/C,cAA8B,EAC9B,MAA0C,EAC1C,MAAc,EACI,EAAE;IACpB,qBAAqB;IACrB,IACE,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE;QACpB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM;QACxB,CA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