From 1d465955be79de95ccff5d45c91dfc1d7347e636 Mon Sep 17 00:00:00 2001 From: Sofia Papacharalampous Date: Fri, 12 Apr 2024 17:37:37 +0300 Subject: [PATCH] moved notification services and components under the "src\notification-service" --- dmp-frontend/src/app/app-routing.module.ts | 6 +- dmp-frontend/src/app/app.module.ts | 1 + .../app/core/common/enum/contact-info-type.ts | 3 - .../enum/notification-inapp-tracking.enum.ts | 4 - .../common/enum/notification-notify-state.ts | 7 - .../enum/notification-template-channel.ts | 4 - .../common/enum/notification-template-kind.ts | 6 - .../enum/notification-tracking-process.ts | 7 - .../enum/notification-tracking-state.ts | 10 -- .../app/core/common/enum/notification-type.ts | 16 --- .../src/app/core/core-service.module.ts | 6 - .../inapp-notification.model.ts | 17 --- .../notification-template.ts | 81 ------------ .../model/notification/notification.model.ts | 22 ---- dmp-frontend/src/app/core/model/user/user.ts | 2 +- .../services/utilities/enum-utils.service.ts | 108 ---------------- ...otification-listing-filters.component.scss | 21 --- .../src/app/ui/navbar/navbar.component.ts | 4 +- dmp-frontend/src/assets/i18n/en.json | 24 ++-- .../pipes/notification-contact-type.pipe.ts | 4 +- .../pipes/notification-notify-state.pipe.ts | 4 +- .../notification-template-channel.pipe.ts | 4 +- .../pipes/notification-template-kind.pipe.ts | 4 +- .../notification-tracking-process.pipe.ts | 4 +- .../pipes/notification-tracking-state.pipe.ts | 4 +- .../pipes/notification-type.pipe.ts | 4 +- .../core/enum/contact-info-type.enum.ts | 2 - .../core/enum/contact-type.enum.ts | 6 - .../core}/enum/email-override-mode.ts | 2 +- .../core}/enum/notification-contact-type.ts | 2 +- .../core}/enum/notification-data-type.ts | 0 .../enum/notification-notify-state.enum.ts | 12 +- .../notification-template-channel.enum.ts | 4 +- .../notification-tracking-process.enum.ts | 10 +- .../enum/notification-tracking-state.enum.ts | 20 +-- .../core/enum/notification-type.enum.ts | 26 ++-- .../enum/tenant-configuration-type.enum.ts | 7 - .../core/formatting/enum-utils.service.ts | 120 +++++++++++------- .../core/formatting/formatting.module.ts | 12 +- .../core/model/inapp-notification.model.ts | 4 +- .../core/model/notification-template.model.ts | 63 +++++++-- .../core/model/notification.model.ts | 23 ++-- .../model/notifier-configuration.model.ts | 5 + .../core/model/tenant-configuration.model.ts | 92 -------------- .../user-notification-preference.model.ts | 6 +- .../core/model/user.model.ts | 36 ------ .../core/query/inapp-notification.lookup.ts | 6 +- .../query/notification-template.lookup.ts | 8 +- .../core/query/notification.lookup.ts | 12 +- .../core/query/tenant-configuration.lookup.ts | 22 ---- .../user-notification-preference.lookup.ts | 6 +- .../services/core-service.module.ts | 6 + .../http}/inapp-notification.service.ts | 12 +- .../services/http}/notification-service.ts | 12 +- .../http}/notification-template.service.ts | 14 +- .../user-notification-preference.service.ts | 26 +--- ...tion-template-field-options.component.html | 0 ...tion-template-field-options.component.scss | 0 ...cation-template-field-options.component.ts | 2 +- ...otification-template-editor.component.html | 0 ...otification-template-editor.component.scss | 0 .../notification-template-editor.component.ts | 20 +-- .../notification-template-editor.model.ts | 12 +- .../notification-template-editor.resolver.ts | 4 +- .../notification-template-editor.service.ts | 0 ...on-template-listing-filters.component.html | 0 ...on-template-listing-filters.component.scss | 0 ...tion-template-listing-filters.component.ts | 14 +- ...tification-template-listing.component.html | 0 ...tification-template-listing.component.scss | 0 ...notification-template-listing.component.ts | 12 +- .../notification-template.module.ts | 4 +- .../notification-template.routing.ts | 0 ...otification-listing-filters.component.html | 0 ...otification-listing-filters.component.scss | 21 +++ .../notification-listing-filters.component.ts | 14 +- .../notification-listing.component.html | 0 .../notification-listing.component.scss | 0 .../notification-listing.component.ts | 8 +- .../admin/notification/notification.module.ts | 7 +- .../notification/notification.routing.ts | 0 .../inapp-notification-editor.component.html | 0 .../inapp-notification-editor.component.scss | 0 .../inapp-notification-editor.component.ts | 6 +- ...notification-listing-dialog.component.html | 0 ...notification-listing-dialog.component.scss | 0 ...p-notification-listing-dialog.component.ts | 10 +- ...otification-listing-filters.component.html | 0 ...otification-listing-filters.component.scss | 0 ...-notification-listing-filters.component.ts | 11 +- ...-inapp-notification-listing.component.html | 1 - ...-inapp-notification-listing.component.scss | 0 ...ne-inapp-notification-listing.component.ts | 15 ++- .../mine-inapp-notification-routing.module.ts | 0 .../mine-inapp-notification.module.ts | 4 +- ...-profile-notifier-list-editor.component.ts | 32 ++--- ...user-profile-notifier-list-editor.model.ts | 48 ------- ...ser-profile-notifier-list-editor.module.ts | 2 - 98 files changed, 374 insertions(+), 826 deletions(-) delete mode 100644 dmp-frontend/src/app/core/common/enum/contact-info-type.ts delete mode 100644 dmp-frontend/src/app/core/common/enum/notification-inapp-tracking.enum.ts delete mode 100644 dmp-frontend/src/app/core/common/enum/notification-notify-state.ts delete mode 100644 dmp-frontend/src/app/core/common/enum/notification-template-channel.ts delete mode 100644 dmp-frontend/src/app/core/common/enum/notification-template-kind.ts delete mode 100644 dmp-frontend/src/app/core/common/enum/notification-tracking-process.ts delete mode 100644 dmp-frontend/src/app/core/common/enum/notification-tracking-state.ts delete mode 100644 dmp-frontend/src/app/core/common/enum/notification-type.ts delete mode 100644 dmp-frontend/src/app/core/model/inapp-notification/inapp-notification.model.ts delete mode 100644 dmp-frontend/src/app/core/model/notification-template/notification-template.ts delete mode 100644 dmp-frontend/src/app/core/model/notification/notification.model.ts delete mode 100644 dmp-frontend/src/app/ui/admin/notification/filters/notification-listing-filters.component.scss delete mode 100644 dmp-frontend/src/notification-service/core/enum/contact-type.enum.ts rename dmp-frontend/src/{app/core/common => notification-service/core}/enum/email-override-mode.ts (79%) rename dmp-frontend/src/{app/core/common => notification-service/core}/enum/notification-contact-type.ts (77%) rename dmp-frontend/src/{app/core/common => notification-service/core}/enum/notification-data-type.ts (100%) delete mode 100644 dmp-frontend/src/notification-service/core/enum/tenant-configuration-type.enum.ts create mode 100644 dmp-frontend/src/notification-service/core/model/notifier-configuration.model.ts delete mode 100644 dmp-frontend/src/notification-service/core/model/tenant-configuration.model.ts delete mode 100644 dmp-frontend/src/notification-service/core/model/user.model.ts rename dmp-frontend/src/{app => notification-service}/core/query/inapp-notification.lookup.ts (61%) rename dmp-frontend/src/{app => notification-service}/core/query/notification-template.lookup.ts (61%) rename dmp-frontend/src/{app => notification-service}/core/query/notification.lookup.ts (59%) delete mode 100644 dmp-frontend/src/notification-service/core/query/tenant-configuration.lookup.ts rename dmp-frontend/src/{app/core/services/inapp-notification => notification-service/services/http}/inapp-notification.service.ts (85%) rename dmp-frontend/src/{app/core/services/notification => notification-service/services/http}/notification-service.ts (72%) rename dmp-frontend/src/{app/core/services/notification-template => notification-service/services/http}/notification-template.service.ts (80%) rename dmp-frontend/src/{app => notification-service}/ui/admin/notification-template/editor/field-options/notification-template-field-options.component.html (100%) rename dmp-frontend/src/{app => notification-service}/ui/admin/notification-template/editor/field-options/notification-template-field-options.component.scss (100%) rename dmp-frontend/src/{app => notification-service}/ui/admin/notification-template/editor/field-options/notification-template-field-options.component.ts (97%) rename dmp-frontend/src/{app => notification-service}/ui/admin/notification-template/editor/notification-template-editor.component.html (100%) rename dmp-frontend/src/{app => notification-service}/ui/admin/notification-template/editor/notification-template-editor.component.scss (100%) rename dmp-frontend/src/{app => notification-service}/ui/admin/notification-template/editor/notification-template-editor.component.ts (92%) rename dmp-frontend/src/{app => notification-service}/ui/admin/notification-template/editor/notification-template-editor.model.ts (96%) rename dmp-frontend/src/{app => notification-service}/ui/admin/notification-template/editor/notification-template-editor.resolver.ts (95%) rename dmp-frontend/src/{app => notification-service}/ui/admin/notification-template/editor/notification-template-editor.service.ts (100%) rename dmp-frontend/src/{app => notification-service}/ui/admin/notification-template/listing/filters/notification-template-listing-filters.component.html (100%) rename dmp-frontend/src/{app => notification-service}/ui/admin/notification-template/listing/filters/notification-template-listing-filters.component.scss (100%) rename dmp-frontend/src/{app => notification-service}/ui/admin/notification-template/listing/filters/notification-template-listing-filters.component.ts (82%) rename dmp-frontend/src/{app => notification-service}/ui/admin/notification-template/listing/notification-template-listing.component.html (100%) rename dmp-frontend/src/{app => notification-service}/ui/admin/notification-template/listing/notification-template-listing.component.scss (100%) rename dmp-frontend/src/{app => notification-service}/ui/admin/notification-template/listing/notification-template-listing.component.ts (93%) rename dmp-frontend/src/{app => notification-service}/ui/admin/notification-template/notification-template.module.ts (92%) rename dmp-frontend/src/{app => notification-service}/ui/admin/notification-template/notification-template.routing.ts (100%) rename dmp-frontend/src/{app => notification-service}/ui/admin/notification/filters/notification-listing-filters.component.html (100%) create mode 100644 dmp-frontend/src/notification-service/ui/admin/notification/filters/notification-listing-filters.component.scss rename dmp-frontend/src/{app => notification-service}/ui/admin/notification/filters/notification-listing-filters.component.ts (86%) rename dmp-frontend/src/{app => notification-service}/ui/admin/notification/notification-listing.component.html (100%) rename dmp-frontend/src/{app => notification-service}/ui/admin/notification/notification-listing.component.scss (100%) rename dmp-frontend/src/{app => notification-service}/ui/admin/notification/notification-listing.component.ts (96%) rename dmp-frontend/src/{app => notification-service}/ui/admin/notification/notification.module.ts (91%) rename dmp-frontend/src/{app => notification-service}/ui/admin/notification/notification.routing.ts (100%) rename dmp-frontend/src/{app => notification-service}/ui/inapp-notification/editor/inapp-notification-editor.component.html (100%) rename dmp-frontend/src/{app => notification-service}/ui/inapp-notification/editor/inapp-notification-editor.component.scss (100%) rename dmp-frontend/src/{app => notification-service}/ui/inapp-notification/editor/inapp-notification-editor.component.ts (94%) rename dmp-frontend/src/{app => notification-service}/ui/inapp-notification/listing-dialog/mine-inapp-notification-listing-dialog.component.html (100%) rename dmp-frontend/src/{app => notification-service}/ui/inapp-notification/listing-dialog/mine-inapp-notification-listing-dialog.component.scss (100%) rename dmp-frontend/src/{app => notification-service}/ui/inapp-notification/listing-dialog/mine-inapp-notification-listing-dialog.component.ts (88%) rename dmp-frontend/src/{app => notification-service}/ui/inapp-notification/listing/filters/mine-inapp-notification-listing-filters.component.html (100%) rename dmp-frontend/src/{app => notification-service}/ui/inapp-notification/listing/filters/mine-inapp-notification-listing-filters.component.scss (100%) rename dmp-frontend/src/{app => notification-service}/ui/inapp-notification/listing/filters/mine-inapp-notification-listing-filters.component.ts (84%) rename dmp-frontend/src/{app => notification-service}/ui/inapp-notification/listing/mine-inapp-notification-listing.component.html (99%) rename dmp-frontend/src/{app => notification-service}/ui/inapp-notification/listing/mine-inapp-notification-listing.component.scss (100%) rename dmp-frontend/src/{app => notification-service}/ui/inapp-notification/listing/mine-inapp-notification-listing.component.ts (90%) rename dmp-frontend/src/{app => notification-service}/ui/inapp-notification/mine-inapp-notification-routing.module.ts (100%) rename dmp-frontend/src/{app => notification-service}/ui/inapp-notification/mine-inapp-notification.module.ts (91%) delete mode 100644 dmp-frontend/src/notification-service/ui/user-profile/notifier-list/user-profile-notifier-list-editor.model.ts diff --git a/dmp-frontend/src/app/app-routing.module.ts b/dmp-frontend/src/app/app-routing.module.ts index 7062c1f82..48b9f1317 100644 --- a/dmp-frontend/src/app/app-routing.module.ts +++ b/dmp-frontend/src/app/app-routing.module.ts @@ -276,7 +276,7 @@ const appRoutes: Routes = [ }, { path: 'notifications', - loadChildren: () => import('./ui/admin/notification/notification.module').then(m => m.NotificationModule), + loadChildren: () => import('@notification-service/ui/admin/notification/notification.module').then(m => m.NotificationModule), data: { authContext: { permissions: [AppPermission.ViewNotificationPage] @@ -288,7 +288,7 @@ const appRoutes: Routes = [ }, { path: 'notification-templates', - loadChildren: () => import('./ui/admin/notification-template/notification-template.module').then(m => m.NotificationTemplateModule), + loadChildren: () => import('@notification-service/ui/admin/notification-template/notification-template.module').then(m => m.NotificationTemplateModule), data: { authContext: { permissions: [AppPermission.ViewNotificationTemplatePage] @@ -300,7 +300,7 @@ const appRoutes: Routes = [ }, { path: 'mine-notifications', - loadChildren: () => import('./ui/inapp-notification/mine-inapp-notification.module').then(m => m.MineInAppNotificationModule), + loadChildren: () => import('@notification-service/ui/inapp-notification/mine-inapp-notification.module').then(m => m.MineInAppNotificationModule), data: { authContext: { permissions: [AppPermission.ViewMineInAppNotificationPage] diff --git a/dmp-frontend/src/app/app.module.ts b/dmp-frontend/src/app/app.module.ts index d8bf2dffb..d7916c359 100644 --- a/dmp-frontend/src/app/app.module.ts +++ b/dmp-frontend/src/app/app.module.ts @@ -121,6 +121,7 @@ export function InstallationConfigurationFactory(appConfig: ConfigurationService KeycloakAngularModule, CoreServiceModule.forRoot(), CoreAnnotationServiceModule.forRoot(), + CoreNotificationServiceModule.forRoot(), AppRoutingModule, CommonUiModule, TranslateModule.forRoot({ diff --git a/dmp-frontend/src/app/core/common/enum/contact-info-type.ts b/dmp-frontend/src/app/core/common/enum/contact-info-type.ts deleted file mode 100644 index 0850b1873..000000000 --- a/dmp-frontend/src/app/core/common/enum/contact-info-type.ts +++ /dev/null @@ -1,3 +0,0 @@ -export enum ContactInfoType { - Email = 0 -} \ No newline at end of file diff --git a/dmp-frontend/src/app/core/common/enum/notification-inapp-tracking.enum.ts b/dmp-frontend/src/app/core/common/enum/notification-inapp-tracking.enum.ts deleted file mode 100644 index 92422833e..000000000 --- a/dmp-frontend/src/app/core/common/enum/notification-inapp-tracking.enum.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum NotificationInAppTracking { - Stored = 0, - Delivered = 1 -} diff --git a/dmp-frontend/src/app/core/common/enum/notification-notify-state.ts b/dmp-frontend/src/app/core/common/enum/notification-notify-state.ts deleted file mode 100644 index c93c24e73..000000000 --- a/dmp-frontend/src/app/core/common/enum/notification-notify-state.ts +++ /dev/null @@ -1,7 +0,0 @@ -export enum NotificationNotifyState { - PENDING = 0, - PROCESSING = 1, - SUCCESSFUL = 2, - ERROR = 3, - OMITTED = 4 -} \ No newline at end of file diff --git a/dmp-frontend/src/app/core/common/enum/notification-template-channel.ts b/dmp-frontend/src/app/core/common/enum/notification-template-channel.ts deleted file mode 100644 index b4f328a34..000000000 --- a/dmp-frontend/src/app/core/common/enum/notification-template-channel.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum NotificationTemplateChannel { - Email = 0, - InApp = 1, -} \ No newline at end of file diff --git a/dmp-frontend/src/app/core/common/enum/notification-template-kind.ts b/dmp-frontend/src/app/core/common/enum/notification-template-kind.ts deleted file mode 100644 index ec0e8a47e..000000000 --- a/dmp-frontend/src/app/core/common/enum/notification-template-kind.ts +++ /dev/null @@ -1,6 +0,0 @@ -export enum NotificationTemplateKind { - Draft = 0, - Secondary = 1, - Primary = 2, - Default = 3 -} diff --git a/dmp-frontend/src/app/core/common/enum/notification-tracking-process.ts b/dmp-frontend/src/app/core/common/enum/notification-tracking-process.ts deleted file mode 100644 index 9cb3e30f3..000000000 --- a/dmp-frontend/src/app/core/common/enum/notification-tracking-process.ts +++ /dev/null @@ -1,7 +0,0 @@ -export enum NotificationTrackingProcess { - PENDING = 0, - PROCESSING = 1, - SUCCESSFUL = 2, - ERROR = 3, - OMITTED = 4 -} \ No newline at end of file diff --git a/dmp-frontend/src/app/core/common/enum/notification-tracking-state.ts b/dmp-frontend/src/app/core/common/enum/notification-tracking-state.ts deleted file mode 100644 index 99b7fca9d..000000000 --- a/dmp-frontend/src/app/core/common/enum/notification-tracking-state.ts +++ /dev/null @@ -1,10 +0,0 @@ -export enum NotificationTrackingState { - UNDEFINED = 0, - NA = 1, - QUEUED = 2, - SENT = 3, - DELIVERED = 4, - UNDELIVERED = 5, - FAILED = 6, - UNSENT = 7 -} \ No newline at end of file diff --git a/dmp-frontend/src/app/core/common/enum/notification-type.ts b/dmp-frontend/src/app/core/common/enum/notification-type.ts deleted file mode 100644 index d8a223f22..000000000 --- a/dmp-frontend/src/app/core/common/enum/notification-type.ts +++ /dev/null @@ -1,16 +0,0 @@ - -export enum NotificationType { - dmpInvitationExternalUserType = '065deecd-21bb-44af-9983-e660fdf24bc4', - dmpInvitationExistingUserType = '4904dea2-5079-46d3-83be-3a19c9ab45dc', - dmpModifiedType = '4542262a-22f8-4baa-9db6-1c8e70ac1dbb', - dmpFinalisedType = '90db0b46-42de-bd89-aebf-6f27efeb256e', - descriptionModifiedType = '4fdbfa80-7a71-4a69-b854-67cbb70648f1', - descriptionFinalisedType = '33790bad-94d4-488a-8ee2-7f6295ca18ea', - mergeAccountConfirmationType = 'bfe68845-cb05-4c5a-a03d-29161a7c9660', - removeCredentialConfirmationType = 'c9bc3f16-057e-4bba-8a5f-36bd835e5604', - dmpDepositType = '55736f7a-83ab-4190-af43-9d031a6f9612', - descriptionTemplateInvitationType = '223bb607-efa1-4ce7-99ec-4beabfef9a8b', - contactSupportType = '5b1d6c52-88f9-418b-9b8a-6f1f963d9ead', - publicContactSupportType = 'b542b606-acc6-4629-adef-4d8ee2f01222' - -} \ No newline at end of file diff --git a/dmp-frontend/src/app/core/core-service.module.ts b/dmp-frontend/src/app/core/core-service.module.ts index 6b668ee72..63b4d6875 100644 --- a/dmp-frontend/src/app/core/core-service.module.ts +++ b/dmp-frontend/src/app/core/core-service.module.ts @@ -31,7 +31,6 @@ import { FileTransformerService } from './services/file-transformer/file-transfo import { PrincipalService } from './services/http/principal.service'; import { LanguageHttpService } from './services/language/language.http.service'; import { MaintenanceService } from './services/maintenance/maintenance.service'; -import { NotificationTemplateService } from './services/notification-template/notification-template.service'; import { ReferenceTypeService } from './services/reference-type/reference-type.service'; import { ReferenceService } from './services/reference/reference.service'; import { SupportiveMaterialService } from './services/supportive-material/supportive-material.service'; @@ -43,8 +42,6 @@ import { UserService } from './services/user/user.service'; import { FileUtils } from './services/utilities/file-utils.service'; import { QueryParamsService } from './services/utilities/query-params.service'; import { FileTransformerHttpService } from './services/file-transformer/file-transformer.http.service'; -import { InAppNotificationService } from './services/inapp-notification/inapp-notification.service'; -import { NotificationService } from './services/notification/notification-service'; import { SemanticsService } from './services/semantic/semantics.service'; import { PrefillingSourceService } from './services/prefilling-source/prefilling-source.service'; import { VisibilityRulesService } from '@app/ui/description/editor/description-form/visibility-rules/visibility-rules.service'; @@ -106,13 +103,10 @@ export class CoreServiceModule { DmpService, DescriptionService, MaintenanceService, - NotificationTemplateService, TagService, CanDeactivateGuard, FileTransformerService, FileTransformerHttpService, - InAppNotificationService, - NotificationService, SemanticsService, PrefillingSourceService, VisibilityRulesService, diff --git a/dmp-frontend/src/app/core/model/inapp-notification/inapp-notification.model.ts b/dmp-frontend/src/app/core/model/inapp-notification/inapp-notification.model.ts deleted file mode 100644 index b0a3a5bb2..000000000 --- a/dmp-frontend/src/app/core/model/inapp-notification/inapp-notification.model.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Guid } from '@common/types/guid'; -import { User } from '../user/user'; -import { IsActive } from '@app/core/common/enum/is-active.enum'; -import { NotificationInAppTracking } from '@app/core/common/enum/notification-inapp-tracking.enum'; - -export interface InAppNotification { - id: Guid; - user: User; - isActive: IsActive; - type: Guid; - trackingState: NotificationInAppTracking; - subject: string; - body: string; - createdAt: Date; - updatedAt: Date; - hash: string; -} diff --git a/dmp-frontend/src/app/core/model/notification-template/notification-template.ts b/dmp-frontend/src/app/core/model/notification-template/notification-template.ts deleted file mode 100644 index b7c2beb4d..000000000 --- a/dmp-frontend/src/app/core/model/notification-template/notification-template.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { NotificationTemplateChannel } from "@app/core/common/enum/notification-template-channel"; -import { NotificationTemplateKind } from "@app/core/common/enum/notification-template-kind"; -import { BaseEntity, BaseEntityPersist } from "@common/base/base-entity.model"; -import { Guid } from "@common/types/guid"; -import { NotificationDataType } from "@app/core/common/enum/notification-data-type"; -import { EmailOverrideMode } from "@app/core/common/enum/email-override-mode"; -import { NotificationType } from "@app/core/common/enum/notification-type"; - -export interface NotificationTemplate extends BaseEntity{ - channel: NotificationTemplateChannel; - notificationType: NotificationType; - kind: NotificationTemplateKind; - languageCode: string; - value: NotificationTemplateValue; -} - -export interface NotificationTemplateValue { - subjectText: string; - subjectKey: string; - subjectFieldOptions: NotificationFieldOptions; - bodyText: string; - bodyKey: string; - priorityKey: string; - allowAttachments: Boolean; - cc: string[]; - ccMode: EmailOverrideMode; - bcc: string[]; - bccMode: EmailOverrideMode; - extraDataKeys: string[]; - bodyFieldOptions: NotificationFieldOptions; -} - -export interface NotificationFieldOptions { - mandatory?: string[]; - optional?: NotificationFieldInfo[]; - formatting?: { [key: string]: string }; -} - -export interface NotificationFieldInfo { - key: string; - type: NotificationDataType, - value: string; -} - -// Persist - -export interface NotificationTemplatePersist extends BaseEntityPersist{ - channel: NotificationTemplateChannel; - notificationType: NotificationType; - kind: NotificationTemplateKind; - languageCode: string; - value: NotificationTemplateValuePersist; -} - -export interface NotificationTemplateValuePersist { - subjectText: string; - subjectKey: string; - subjectFieldOptions: NotificationFieldOptionsPersist; - bodyText: string; - bodyKey: string; - priorityKey: string; - allowAttachments: Boolean; - cc: string[]; - ccMode: EmailOverrideMode; - bcc: string[]; - bccMode: EmailOverrideMode; - extraDataKeys: string[]; - bodyFieldOptions: NotificationFieldOptionsPersist; -} - -export interface NotificationFieldOptionsPersist { - mandatory?: string[]; - optional?: NotificationFieldInfoPersist[]; - formatting?: { [key: string]: string }; -} - -export interface NotificationFieldInfoPersist { - key: string; - type: NotificationDataType, - value: string; -} diff --git a/dmp-frontend/src/app/core/model/notification/notification.model.ts b/dmp-frontend/src/app/core/model/notification/notification.model.ts deleted file mode 100644 index 39088df68..000000000 --- a/dmp-frontend/src/app/core/model/notification/notification.model.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { NotificationContactType } from '@app/core/common/enum/notification-contact-type'; -import { User } from '../user/user'; -import { NotificationType } from '@app/core/common/enum/notification-type'; -import { BaseEntity } from '@common/base/base-entity.model'; -import { NotificationNotifyState } from '@app/core/common/enum/notification-notify-state'; -import { NotificationTrackingProcess } from '@app/core/common/enum/notification-tracking-process'; -import { NotificationTrackingState } from '@app/core/common/enum/notification-tracking-state'; - -export interface Notification extends BaseEntity{ - user: User; - type: NotificationType; - contactTypeHint: NotificationContactType; - contactHint: string; - data: string; - notifyState: NotificationNotifyState; - notifiedWith: NotificationContactType; - notifiedAt: Date; - retryCount: number; - trackingState: NotificationTrackingState; - trackingProcess: NotificationTrackingProcess; - trackingData: string; -} diff --git a/dmp-frontend/src/app/core/model/user/user.ts b/dmp-frontend/src/app/core/model/user/user.ts index 32dd67d46..fdf48441a 100644 --- a/dmp-frontend/src/app/core/model/user/user.ts +++ b/dmp-frontend/src/app/core/model/user/user.ts @@ -1,8 +1,8 @@ -import { ContactInfoType } from "@app/core/common/enum/contact-info-type"; import { RoleOrganizationType } from "@app/core/common/enum/role-organization-type"; import { BaseEntity, BaseEntityPersist } from "@common/base/base-entity.model"; import { Guid } from "@common/types/guid"; import { Reference } from "../reference/reference"; +import { ContactInfoType } from "@notification-service/core/enum/contact-info-type.enum"; export interface User extends BaseEntity { name: string; diff --git a/dmp-frontend/src/app/core/services/utilities/enum-utils.service.ts b/dmp-frontend/src/app/core/services/utilities/enum-utils.service.ts index 28acfd87e..0a4067e14 100644 --- a/dmp-frontend/src/app/core/services/utilities/enum-utils.service.ts +++ b/dmp-frontend/src/app/core/services/utilities/enum-utils.service.ts @@ -10,17 +10,7 @@ import { DmpBlueprintStatus } from '@app/core/common/enum/dmp-blueprint-status'; import { DmpBlueprintSystemFieldType } from '@app/core/common/enum/dmp-blueprint-system-field-type'; import { DmpContactType } from '@app/core/common/enum/dmp-contact-type'; import { DmpUserRole } from '@app/core/common/enum/dmp-user-role'; -import { EmailOverrideMode } from '@app/core/common/enum/email-override-mode'; import { IsActive } from '@app/core/common/enum/is-active.enum'; -import { NotificationContactType } from '@app/core/common/enum/notification-contact-type'; -import { NotificationDataType } from '@app/core/common/enum/notification-data-type'; -import { NotificationInAppTracking } from '@app/core/common/enum/notification-inapp-tracking.enum'; -import { NotificationNotifyState } from '@app/core/common/enum/notification-notify-state'; -import { NotificationTemplateChannel } from '@app/core/common/enum/notification-template-channel'; -import { NotificationTemplateKind } from '@app/core/common/enum/notification-template-kind'; -import { NotificationTrackingProcess } from '@app/core/common/enum/notification-tracking-process'; -import { NotificationTrackingState } from '@app/core/common/enum/notification-tracking-state'; -import { NotificationType } from '@app/core/common/enum/notification-type'; import { RecentActivityOrder } from '@app/core/common/enum/recent-activity-order'; import { ReferenceFieldDataType } from '@app/core/common/enum/reference-field-data-type'; import { ReferenceSourceType } from '@app/core/common/enum/reference-source-type'; @@ -234,40 +224,6 @@ export class EnumUtils { } } - toNotificationTemplateKindString(status: NotificationTemplateKind): string { - switch (status) { - case NotificationTemplateKind.Draft: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-KIND.DRAFT'); - case NotificationTemplateKind.Secondary: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-KIND.SECONDARY'); - case NotificationTemplateKind.Primary: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-KIND.PRIMARY'); - case NotificationTemplateKind.Default: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-KIND.DEFAULT'); - } - } - - toNotificationTemplateChannelString(status: NotificationTemplateChannel): string { - switch (status) { - case NotificationTemplateChannel.Email: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-CHANNEL.EMAIL'); - case NotificationTemplateChannel.InApp: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-CHANNEL.INAPP'); - } - } - - toNotificationTemplateDataTypeString(status: NotificationDataType): string { - switch (status) { - case NotificationDataType.Integer: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-DATA-TYPE.INTEGER'); - case NotificationDataType.Demical: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-DATA-TYPE.DEMICAL'); - case NotificationDataType.Double: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-DATA-TYPE.DOUBLE'); - case NotificationDataType.DateTime: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-DATA-TYPE.DATE-TIME'); - case NotificationDataType.String: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-DATA-TYPE.STRING'); - } - } - - toEmailOverrideModeString(status: EmailOverrideMode): string { - switch (status) { - case EmailOverrideMode.NotOverride: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-EMAIL-OVERRIDE-MODE.NOT'); - case EmailOverrideMode.Additive: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-EMAIL-OVERRIDE-MODE.ADDITIVE'); - case EmailOverrideMode.Replace: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-EMAIL-OVERRIDE-MODE.REPLACE'); - } - } - toRecentActivityOrderString(status: RecentActivityOrder): string { switch (status) { // case RecentActivityOrder.CREATED: return this.language.instant('TYPES.RECENT-ACTIVITY-ORDER.CREATED'); @@ -280,70 +236,6 @@ export class EnumUtils { } } - toNotificationTypeString(status: NotificationType): string { - switch (status) { - case NotificationType.dmpInvitationExternalUserType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.DMP-INVITATION-EXTERNAL-USER'); - case NotificationType.dmpInvitationExistingUserType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.DMP-INVITATION-EXISTING-USER'); - case NotificationType.dmpModifiedType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.DMP-MODIFIED'); - case NotificationType.dmpFinalisedType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.DMP-FINALISED'); - case NotificationType.descriptionModifiedType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.DESCRIPTION-MODIFIED'); - case NotificationType.descriptionFinalisedType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.DESCRIPTION-FINALISED'); - case NotificationType.mergeAccountConfirmationType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.MERGE-ACCOUNT-CONFIRMATION'); - case NotificationType.removeCredentialConfirmationType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.REMOVE-CREDENTIAL-CONFIRMATION'); - case NotificationType.dmpDepositType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.DMP-DEPOSIT'); - case NotificationType.descriptionTemplateInvitationType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.DESCRIPTION-TEMPLATE-INVITATION'); - case NotificationType.contactSupportType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.CONTACT-SUPPORT'); - case NotificationType.publicContactSupportType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.PUBLIC-CONTACT-SUPPORT'); - } - } - - public toNotificationInAppTrackingString(value: NotificationInAppTracking): string { - switch (value) { - case NotificationInAppTracking.Delivered: return this.language.instant('TYPES.NOTIFICATION-INAPP-TRACKING.DELIVERED'); - case NotificationInAppTracking.Stored: return this.language.instant('TYPES.NOTIFICATION-INAPP-TRACKING.STORED'); - } - } - - public toNotificationContactTypeString(value: NotificationContactType): string { - switch (value) { - case NotificationContactType.EMAIL: return this.language.instant('TYPES.NOTIFICATION-CONTACT-TYPE.EMAIL'); - case NotificationContactType.IN_APP: return this.language.instant('TYPES.NOTIFICATION-CONTACT-TYPE.INAPP'); - } - } - - public toNotificationNotifyStateString(value: NotificationNotifyState): string { - switch (value) { - case NotificationNotifyState.PENDING: return this.language.instant('TYPES.NOTIFICATION-NOTIFY-STATE.PENDING'); - case NotificationNotifyState.PROCESSING: return this.language.instant('TYPES.NOTIFICATION-NOTIFY-STATE.PROCESSING'); - case NotificationNotifyState.SUCCESSFUL: return this.language.instant('TYPES.NOTIFICATION-NOTIFY-STATE.SUCCESSFUL'); - case NotificationNotifyState.ERROR: return this.language.instant('TYPES.NOTIFICATION-NOTIFY-STATE.ERROR'); - case NotificationNotifyState.OMITTED: return this.language.instant('TYPES.NOTIFICATION-NOTIFY-STATE.OMITTED'); - } - } - - public toNotificationTrackingStateString(value: NotificationTrackingState): string { - switch (value) { - case NotificationTrackingState.UNDEFINED: return this.language.instant('TYPES.NOTIFICATION-TRACKING-STATE.UNDEFINED'); - case NotificationTrackingState.NA: return this.language.instant('TYPES.NOTIFICATION-TRACKING-STATE.NA'); - case NotificationTrackingState.QUEUED: return this.language.instant('TYPES.NOTIFICATION-TRACKING-STATE.QUEUED'); - case NotificationTrackingState.SENT: return this.language.instant('TYPES.NOTIFICATION-TRACKING-STATE.SENT'); - case NotificationTrackingState.DELIVERED: return this.language.instant('TYPES.NOTIFICATION-TRACKING-STATE.DELIVERED'); - case NotificationTrackingState.UNDELIVERED: return this.language.instant('TYPES.NOTIFICATION-TRACKING-STATE.UNDELIVERED'); - case NotificationTrackingState.FAILED: return this.language.instant('TYPES.NOTIFICATION-TRACKING-STATE.FAILED'); - case NotificationTrackingState.UNSENT: return this.language.instant('TYPES.NOTIFICATION-TRACKING-STATE.UNSENT'); - } - } - - public toNotificationTrackingProcessString(value: NotificationTrackingProcess): string { - switch (value) { - case NotificationTrackingProcess.PENDING: return this.language.instant('TYPES.NOTIFICATION-TRACKING-PROCESS.PENDING'); - case NotificationTrackingProcess.PROCESSING: return this.language.instant('TYPES.NOTIFICATION-TRACKING-PROCESS.PROCESSING'); - case NotificationTrackingProcess.SUCCESSFUL: return this.language.instant('TYPES.NOTIFICATION-TRACKING-PROCESS.SUCCESSFUL'); - case NotificationTrackingProcess.ERROR: return this.language.instant('TYPES.NOTIFICATION-TRACKING-PROCESS.ERROR'); - case NotificationTrackingProcess.OMITTED: return this.language.instant('TYPES.NOTIFICATION-TRACKING-PROCESS.OMITTED'); - } - } - public toDmpAccessTypeString(value: DmpAccessType): string { switch (value) { case DmpAccessType.Public: return this.language.instant('TYPES.DMP-ACCESS-TYPE.PUBLIC'); diff --git a/dmp-frontend/src/app/ui/admin/notification/filters/notification-listing-filters.component.scss b/dmp-frontend/src/app/ui/admin/notification/filters/notification-listing-filters.component.scss deleted file mode 100644 index ea00a215c..000000000 --- a/dmp-frontend/src/app/ui/admin/notification/filters/notification-listing-filters.component.scss +++ /dev/null @@ -1,21 +0,0 @@ -::ng-deep.mat-mdc-menu-panel { - max-width: 100% !important; - height: 100% !important; -} - -:host::ng-deep.mat-mdc-menu-content:not(:empty) { - padding-top: 0 !important; -} - - -.filter-button{ - padding-top: .6rem; - padding-bottom: .6rem; - // .mat-icon{ - // font-size: 1.5em; - // width: 1.2em; - // height: 1.2em; - // } -} - - diff --git a/dmp-frontend/src/app/ui/navbar/navbar.component.ts b/dmp-frontend/src/app/ui/navbar/navbar.component.ts index 0e91df8fe..1623f4a66 100644 --- a/dmp-frontend/src/app/ui/navbar/navbar.component.ts +++ b/dmp-frontend/src/app/ui/navbar/navbar.component.ts @@ -15,8 +15,8 @@ import { takeUntil } from 'rxjs/operators'; import { StartNewDmpDialogComponent } from '../dmp/new/start-new-dmp-dialogue/start-new-dmp-dialog.component'; import { FaqDialogComponent } from '../faq/dialog/faq-dialog.component'; import { UserDialogComponent } from './user-dialog/user-dialog.component'; -import { MineInAppNotificationListingDialogComponent } from '../inapp-notification/listing-dialog/mine-inapp-notification-listing-dialog.component'; -import { InAppNotificationService } from '@app/core/services/inapp-notification/inapp-notification.service'; +import { MineInAppNotificationListingDialogComponent } from '@notification-service/ui/inapp-notification/listing-dialog/mine-inapp-notification-listing-dialog.component'; +import { InAppNotificationService } from '@notification-service/services/http/inapp-notification.service'; import { timer } from 'rxjs'; import { ConfigurationService } from '@app/core/services/configuration/configuration.service'; diff --git a/dmp-frontend/src/assets/i18n/en.json b/dmp-frontend/src/assets/i18n/en.json index 4f728aec4..164d11e80 100644 --- a/dmp-frontend/src/assets/i18n/en.json +++ b/dmp-frontend/src/assets/i18n/en.json @@ -1130,16 +1130,18 @@ "INACTIVE": "Inactive" }, "NOTIFICATION-TYPE": { - "REGISTRATION-INVITATION": "Registration Invitation", - "TOTP-OVERRIDE-USED": "TOPT Override Used", - "CREDENTIAL-RESET": "Credential Reset", - "DIRECT-LINK": "Direct Link", - "FORGET-ME-REQUEST": "Forget me Request", - "WHAT-YOU-KNOW-ABOUT-ME-REQUEST": "'What you Know about me' request", - "WHAT-YOU-KNOW-ABOUT-ME-REQUEST-COMPLETED": "Completion of 'what you Know about me' request", - "EMAIL-RESET-REQUEST": "Email reset request", - "EMAIL-RESET-AWARENESS": "Awareness of 'email reset' request", - "EMAIL-RESET-REMOVE": "Remove email reset request" + "DMP-INVITATION-EXISTING-USER-TYPE": "DMP invitation on existing user", + "DMP-INVITATION-EXTERNAL-USER-TYPE": "DMP invitation on external user", + "DMP-MODIFIED-TYPE": "Modified a DMP", + "DMP-FINALISED-TYPE": "Finalised a DMP", + "DESCRIPTION-MODIFIED-TYPE": "Modified a Description", + "DESCRIPTION-FINALISED-TYPE": "Finalised a Description", + "MERGE-ACCOUNT-CONFIRMATION-TYPE": "Confirmation to merge an account", + "REMOVE-CREDENTIAL-CONFIRMATION-TYPE": "Confirmation to remove an account", + "DMP-DEPOSIT-TYPE": "Deposit a DMP", + "DESCRIPTION-TEMPLATE-INVITATION-TYPE": "Description Template invitation", + "CONTACT-SUPPORT-TYPE": "Contact Support", + "PUBLIC-CONTACT-SUPPORT-TYPE": "Public Contact Support" } }, "USER-PROFILE": { @@ -1710,7 +1712,7 @@ "INTERNAL": "Internal", "EXTERNAL": "External" }, - "NOTIFICATION-TEMPLATE-KIND": { + "NOTIFICATION-TEMPLATE-KIND - HERE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!": { "DRAFT": "Draft", "SECONDARY": "Secondary", "PRIMARY": "Primary", diff --git a/dmp-frontend/src/common/formatting/pipes/notification-contact-type.pipe.ts b/dmp-frontend/src/common/formatting/pipes/notification-contact-type.pipe.ts index 160498482..ed4d7fe92 100644 --- a/dmp-frontend/src/common/formatting/pipes/notification-contact-type.pipe.ts +++ b/dmp-frontend/src/common/formatting/pipes/notification-contact-type.pipe.ts @@ -1,9 +1,9 @@ import { Pipe, PipeTransform } from '@angular/core'; -import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; +import { NotificationServiceEnumUtils } from '@notification-service/core/formatting/enum-utils.service'; @Pipe({ name: 'NotificationContactTypeFormat' }) export class NotificationContactTypePipe implements PipeTransform { - constructor(private enumUtils: EnumUtils) { } + constructor(private enumUtils: NotificationServiceEnumUtils) { } public transform(value): any { return this.enumUtils.toNotificationContactTypeString(value); diff --git a/dmp-frontend/src/common/formatting/pipes/notification-notify-state.pipe.ts b/dmp-frontend/src/common/formatting/pipes/notification-notify-state.pipe.ts index f056c5bb1..7aa4bc0b0 100644 --- a/dmp-frontend/src/common/formatting/pipes/notification-notify-state.pipe.ts +++ b/dmp-frontend/src/common/formatting/pipes/notification-notify-state.pipe.ts @@ -1,9 +1,9 @@ import { Pipe, PipeTransform } from '@angular/core'; -import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; +import { NotificationServiceEnumUtils } from '@notification-service/core/formatting/enum-utils.service'; @Pipe({ name: 'NotificationNotifyStateFormat' }) export class NotificationNotifyStatePipe implements PipeTransform { - constructor(private enumUtils: EnumUtils) { } + constructor(private enumUtils: NotificationServiceEnumUtils) { } public transform(value): any { return this.enumUtils.toNotificationNotifyStateString(value); diff --git a/dmp-frontend/src/common/formatting/pipes/notification-template-channel.pipe.ts b/dmp-frontend/src/common/formatting/pipes/notification-template-channel.pipe.ts index 2a27f2b03..3ce91d909 100644 --- a/dmp-frontend/src/common/formatting/pipes/notification-template-channel.pipe.ts +++ b/dmp-frontend/src/common/formatting/pipes/notification-template-channel.pipe.ts @@ -1,9 +1,9 @@ import { Pipe, PipeTransform } from '@angular/core'; -import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; +import { NotificationServiceEnumUtils } from '@notification-service/core/formatting/enum-utils.service'; @Pipe({ name: 'NotificationTemplateChannelFormat' }) export class NotificationTemplateChannelPipe implements PipeTransform { - constructor(private enumUtils: EnumUtils) { } + constructor(private enumUtils: NotificationServiceEnumUtils) { } public transform(value): any { return this.enumUtils.toNotificationTemplateChannelString(value); diff --git a/dmp-frontend/src/common/formatting/pipes/notification-template-kind.pipe.ts b/dmp-frontend/src/common/formatting/pipes/notification-template-kind.pipe.ts index a774eb517..e3c9c4d90 100644 --- a/dmp-frontend/src/common/formatting/pipes/notification-template-kind.pipe.ts +++ b/dmp-frontend/src/common/formatting/pipes/notification-template-kind.pipe.ts @@ -1,9 +1,9 @@ import { Pipe, PipeTransform } from '@angular/core'; -import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; +import { NotificationServiceEnumUtils } from '@notification-service/core/formatting/enum-utils.service'; @Pipe({ name: 'NotificationTemplateKindFormat' }) export class NotificationTemplateKindPipe implements PipeTransform { - constructor(private enumUtils: EnumUtils) { } + constructor(private enumUtils: NotificationServiceEnumUtils) { } public transform(value): any { return this.enumUtils.toNotificationTemplateKindString(value); diff --git a/dmp-frontend/src/common/formatting/pipes/notification-tracking-process.pipe.ts b/dmp-frontend/src/common/formatting/pipes/notification-tracking-process.pipe.ts index de69188b6..fd4dcc8ae 100644 --- a/dmp-frontend/src/common/formatting/pipes/notification-tracking-process.pipe.ts +++ b/dmp-frontend/src/common/formatting/pipes/notification-tracking-process.pipe.ts @@ -1,9 +1,9 @@ import { Pipe, PipeTransform } from '@angular/core'; -import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; +import { NotificationServiceEnumUtils } from '@notification-service/core/formatting/enum-utils.service'; @Pipe({ name: 'NotificationTrackingProcessFormat' }) export class NotificationTrackingProcessPipe implements PipeTransform { - constructor(private enumUtils: EnumUtils) { } + constructor(private enumUtils: NotificationServiceEnumUtils) { } public transform(value): any { return this.enumUtils.toNotificationTrackingProcessString(value); diff --git a/dmp-frontend/src/common/formatting/pipes/notification-tracking-state.pipe.ts b/dmp-frontend/src/common/formatting/pipes/notification-tracking-state.pipe.ts index 450225329..3a4304b23 100644 --- a/dmp-frontend/src/common/formatting/pipes/notification-tracking-state.pipe.ts +++ b/dmp-frontend/src/common/formatting/pipes/notification-tracking-state.pipe.ts @@ -1,9 +1,9 @@ import { Pipe, PipeTransform } from '@angular/core'; -import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; +import { NotificationServiceEnumUtils } from '@notification-service/core/formatting/enum-utils.service'; @Pipe({ name: 'NotificationTrackingStateFormat' }) export class NotificationTrackingStatePipe implements PipeTransform { - constructor(private enumUtils: EnumUtils) { } + constructor(private enumUtils: NotificationServiceEnumUtils) { } public transform(value): any { return this.enumUtils.toNotificationTrackingStateString(value); diff --git a/dmp-frontend/src/common/formatting/pipes/notification-type.pipe.ts b/dmp-frontend/src/common/formatting/pipes/notification-type.pipe.ts index 4e26ccb69..fc46fc4f4 100644 --- a/dmp-frontend/src/common/formatting/pipes/notification-type.pipe.ts +++ b/dmp-frontend/src/common/formatting/pipes/notification-type.pipe.ts @@ -1,9 +1,9 @@ import { Pipe, PipeTransform } from '@angular/core'; -import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; +import { NotificationServiceEnumUtils } from '@notification-service/core/formatting/enum-utils.service'; @Pipe({ name: 'NotificationTypeFormat' }) export class NotificationTypePipe implements PipeTransform { - constructor(private enumUtils: EnumUtils) { } + constructor(private enumUtils: NotificationServiceEnumUtils) { } public transform(value): any { return this.enumUtils.toNotificationTypeString(value); diff --git a/dmp-frontend/src/notification-service/core/enum/contact-info-type.enum.ts b/dmp-frontend/src/notification-service/core/enum/contact-info-type.enum.ts index c7d02933f..03736c42f 100644 --- a/dmp-frontend/src/notification-service/core/enum/contact-info-type.enum.ts +++ b/dmp-frontend/src/notification-service/core/enum/contact-info-type.enum.ts @@ -1,5 +1,3 @@ export enum ContactInfoType { Email = 0, - MobilePhone = 1, - LandLinePhone = 2, } diff --git a/dmp-frontend/src/notification-service/core/enum/contact-type.enum.ts b/dmp-frontend/src/notification-service/core/enum/contact-type.enum.ts deleted file mode 100644 index 9ca81fb54..000000000 --- a/dmp-frontend/src/notification-service/core/enum/contact-type.enum.ts +++ /dev/null @@ -1,6 +0,0 @@ -export enum ContactType { - Email = 0, - SlackBroadcast = 1, - Sms = 2, - InApp = 3, -} diff --git a/dmp-frontend/src/app/core/common/enum/email-override-mode.ts b/dmp-frontend/src/notification-service/core/enum/email-override-mode.ts similarity index 79% rename from dmp-frontend/src/app/core/common/enum/email-override-mode.ts rename to dmp-frontend/src/notification-service/core/enum/email-override-mode.ts index 45391e9b3..b2a228a8f 100644 --- a/dmp-frontend/src/app/core/common/enum/email-override-mode.ts +++ b/dmp-frontend/src/notification-service/core/enum/email-override-mode.ts @@ -1,5 +1,5 @@ export enum EmailOverrideMode { NotOverride = 0, Additive = 1, - Replace = 2 + Replace = 2 } \ No newline at end of file diff --git a/dmp-frontend/src/app/core/common/enum/notification-contact-type.ts b/dmp-frontend/src/notification-service/core/enum/notification-contact-type.ts similarity index 77% rename from dmp-frontend/src/app/core/common/enum/notification-contact-type.ts rename to dmp-frontend/src/notification-service/core/enum/notification-contact-type.ts index a0d2bd316..298a9ec60 100644 --- a/dmp-frontend/src/app/core/common/enum/notification-contact-type.ts +++ b/dmp-frontend/src/notification-service/core/enum/notification-contact-type.ts @@ -1,4 +1,4 @@ export enum NotificationContactType { - EMAIL = 0, + EMAIL = 0, IN_APP = 3, } \ No newline at end of file diff --git a/dmp-frontend/src/app/core/common/enum/notification-data-type.ts b/dmp-frontend/src/notification-service/core/enum/notification-data-type.ts similarity index 100% rename from dmp-frontend/src/app/core/common/enum/notification-data-type.ts rename to dmp-frontend/src/notification-service/core/enum/notification-data-type.ts diff --git a/dmp-frontend/src/notification-service/core/enum/notification-notify-state.enum.ts b/dmp-frontend/src/notification-service/core/enum/notification-notify-state.enum.ts index a6f151ecf..10f094de7 100644 --- a/dmp-frontend/src/notification-service/core/enum/notification-notify-state.enum.ts +++ b/dmp-frontend/src/notification-service/core/enum/notification-notify-state.enum.ts @@ -1,7 +1,7 @@ export enum NotificationNotifyState { - Pending = 0, - Processing = 1, - Successful = 2, - Error = 3, - Omitted = 4 -} + PENDING = 0, + PROCESSING = 1, + SUCCESSFUL = 2, + ERROR = 3, + OMITTED = 4 +} \ No newline at end of file diff --git a/dmp-frontend/src/notification-service/core/enum/notification-template-channel.enum.ts b/dmp-frontend/src/notification-service/core/enum/notification-template-channel.enum.ts index b4a4e9384..52246b115 100644 --- a/dmp-frontend/src/notification-service/core/enum/notification-template-channel.enum.ts +++ b/dmp-frontend/src/notification-service/core/enum/notification-template-channel.enum.ts @@ -1,6 +1,4 @@ export enum NotificationTemplateChannel { Email = 0, - SlackBroadcast = 1, - Sms = 2, - InApp = 3, + InApp = 1, } diff --git a/dmp-frontend/src/notification-service/core/enum/notification-tracking-process.enum.ts b/dmp-frontend/src/notification-service/core/enum/notification-tracking-process.enum.ts index c932e91ac..f7fe3f376 100644 --- a/dmp-frontend/src/notification-service/core/enum/notification-tracking-process.enum.ts +++ b/dmp-frontend/src/notification-service/core/enum/notification-tracking-process.enum.ts @@ -1,7 +1,7 @@ export enum NotificationTrackingProcess { - Pending = 0, - Processing = 1, - Completed = 2, - Error = 3, - Omitted = 4 + PENDING = 0, + PROCESSING = 1, + SUCCESSFUL = 2, + ERROR = 3, + OMITTED = 4 } diff --git a/dmp-frontend/src/notification-service/core/enum/notification-tracking-state.enum.ts b/dmp-frontend/src/notification-service/core/enum/notification-tracking-state.enum.ts index cc40aee45..732ebc90a 100644 --- a/dmp-frontend/src/notification-service/core/enum/notification-tracking-state.enum.ts +++ b/dmp-frontend/src/notification-service/core/enum/notification-tracking-state.enum.ts @@ -1,16 +1,10 @@ export enum NotificationTrackingState { - /// - /// Initial state - /// - Undefined = 0, - /// - /// Final for notifiers that do not provide any kind of tracking - /// + UNDEFINED = 0, NA = 1, - Queued = 2, - Sent = 3, - Delivered = 4, - Undelivered = 5, - Failed = 6, - Unsent = 7 + QUEUED = 2, + SENT = 3, + DELIVERED = 4, + UNDELIVERED = 5, + FAILED = 6, + UNSENT = 7 } diff --git a/dmp-frontend/src/notification-service/core/enum/notification-type.enum.ts b/dmp-frontend/src/notification-service/core/enum/notification-type.enum.ts index bf9861f19..d5deb67b9 100644 --- a/dmp-frontend/src/notification-service/core/enum/notification-type.enum.ts +++ b/dmp-frontend/src/notification-service/core/enum/notification-type.enum.ts @@ -1,16 +1,14 @@ export enum NotificationType { - RegistrationInvitation = '4fdbfa80-7a71-4a69-b854-67cbb70648f1', - TotpOverrideUsed = '065deecd-21bb-44af-9983-e660fdf24bc4', - CredentialReset = '90db0b46-42de-bd89-aebf-6f27efeb256e', - DirectLink = 'bfe68845-cb05-4c5a-a03d-29161a7c9660', - ForgetMeRequest = '4542262a-22f8-4baa-9db6-1c8e70ac1dbb', - WhatYouKnowAboutMeRequest = 'd3cd55fe-8da2-42e7-a501-3795ee4f16d3', - WhatYouKnowAboutMeRequestCompleted = '55736f7a-83ab-4190-af43-9d031a6f9612', - EmailResetRequest = '223bb607-efa1-4ce7-99ec-4beabfef9a8b', - EmailResetAwareness = 'c9bc3f16-057e-4bba-8a5f-36bd835e5604', - EmailResetRemove = '1aeb49e8-c817-4088-8b45-08e0a5155796', - Unknown1 = "5b1d6c52-88f9-418b-9b8a-6f1f963d9ead", - Unknown2 = "b542b606-acc6-4629-adef-4d8ee2f01222", - Unknown3 = "33790bad-94d4-488a-8ee2-7f6295ca18ea", - Unknown4 = "4904dea2-5079-46d3-83be-3a19c9ab45dc", + dmpInvitationExternalUserType = '065deecd-21bb-44af-9983-e660fdf24bc4', + dmpInvitationExistingUserType = '4904dea2-5079-46d3-83be-3a19c9ab45dc', + dmpModifiedType = '4542262a-22f8-4baa-9db6-1c8e70ac1dbb', + dmpFinalisedType = '90db0b46-42de-bd89-aebf-6f27efeb256e', + descriptionModifiedType = '4fdbfa80-7a71-4a69-b854-67cbb70648f1', + descriptionFinalisedType = '33790bad-94d4-488a-8ee2-7f6295ca18ea', + mergeAccountConfirmationType = 'bfe68845-cb05-4c5a-a03d-29161a7c9660', + removeCredentialConfirmationType = 'c9bc3f16-057e-4bba-8a5f-36bd835e5604', + dmpDepositType = '55736f7a-83ab-4190-af43-9d031a6f9612', + descriptionTemplateInvitationType = '223bb607-efa1-4ce7-99ec-4beabfef9a8b', + contactSupportType = '5b1d6c52-88f9-418b-9b8a-6f1f963d9ead', + publicContactSupportType = 'b542b606-acc6-4629-adef-4d8ee2f01222' } diff --git a/dmp-frontend/src/notification-service/core/enum/tenant-configuration-type.enum.ts b/dmp-frontend/src/notification-service/core/enum/tenant-configuration-type.enum.ts deleted file mode 100644 index 408f613de..000000000 --- a/dmp-frontend/src/notification-service/core/enum/tenant-configuration-type.enum.ts +++ /dev/null @@ -1,7 +0,0 @@ -export enum TenantConfigurationType { - SlackBroadcast = 0, - EmailClientConfiguration = 1, - SmsClientConfiguration = 2, - DefaultUserLocale = 3, - NotifierList = 4 -} diff --git a/dmp-frontend/src/notification-service/core/formatting/enum-utils.service.ts b/dmp-frontend/src/notification-service/core/formatting/enum-utils.service.ts index 3df2f1c31..349f1faca 100644 --- a/dmp-frontend/src/notification-service/core/formatting/enum-utils.service.ts +++ b/dmp-frontend/src/notification-service/core/formatting/enum-utils.service.ts @@ -1,7 +1,6 @@ import { Injectable } from '@angular/core'; import { BaseEnumUtilsService } from '@common/base/base-enum-utils.service'; import { TranslateService } from '@ngx-translate/core'; -import { ContactType } from '@notification-service/core/enum/contact-type.enum'; import { IsActive } from '@notification-service/core/enum/is-active.enum'; import { NotificationInAppTracking } from '@notification-service/core/enum/notification-inapp-tracking.enum'; import { NotificationNotifyState } from '@notification-service/core/enum/notification-notify-state.enum'; @@ -10,6 +9,9 @@ import { NotificationTemplateKind } from '@notification-service/core/enum/notifi import { NotificationTrackingProcess } from '@notification-service/core/enum/notification-tracking-process.enum'; import { NotificationTrackingState } from '@notification-service/core/enum/notification-tracking-state.enum'; import { NotificationType } from '@notification-service/core/enum/notification-type.enum'; +import { NotificationDataType } from '../enum/notification-data-type'; +import { EmailOverrideMode } from '../enum/email-override-mode'; +import { NotificationContactType } from '../enum/notification-contact-type'; @Injectable() export class NotificationServiceEnumUtils extends BaseEnumUtilsService { @@ -26,74 +28,70 @@ export class NotificationServiceEnumUtils extends BaseEnumUtilsService { public toNotificationTypeString(value: NotificationType): string { switch (value) { - case NotificationType.RegistrationInvitation: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-TYPE.REGISTRATION-INVITATION'); - case NotificationType.TotpOverrideUsed: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-TYPE.TOTP-OVERRIDE-USED'); - case NotificationType.CredentialReset: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-TYPE.CREDENTIAL-RESET'); - case NotificationType.DirectLink: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-TYPE.DIRECT-LINK'); - case NotificationType.ForgetMeRequest: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-TYPE.FORGET-ME-REQUEST'); - case NotificationType.WhatYouKnowAboutMeRequest: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-TYPE.WHAT-YOU-KNOW-ABOUT-ME-REQUEST'); - case NotificationType.WhatYouKnowAboutMeRequestCompleted: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-TYPE.WHAT-YOU-KNOW-ABOUT-ME-REQUEST-COMPLETED'); - case NotificationType.EmailResetRequest: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-TYPE.EMAIL-RESET-REQUEST'); - case NotificationType.EmailResetAwareness: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-TYPE.EMAIL-RESET-AWARENESS'); - case NotificationType.EmailResetRemove: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-TYPE.EMAIL-RESET-REMOVE'); - case NotificationType.Unknown1: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-TYPE.UNKOWN1'); - case NotificationType.Unknown2: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-TYPE.UNKOWN2'); - case NotificationType.Unknown3: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-TYPE.UNKOWN3'); - case NotificationType.Unknown4: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-TYPE.UNKOWN4'); + case NotificationType.dmpInvitationExternalUserType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.DMP-INVITATION-EXTERNAL-USER'); + case NotificationType.dmpInvitationExistingUserType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.DMP-INVITATION-EXISTING-USER'); + case NotificationType.dmpModifiedType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.DMP-MODIFIED'); + case NotificationType.dmpFinalisedType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.DMP-FINALISED'); + case NotificationType.descriptionModifiedType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.DESCRIPTION-MODIFIED'); + case NotificationType.descriptionFinalisedType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.DESCRIPTION-FINALISED'); + case NotificationType.mergeAccountConfirmationType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.MERGE-ACCOUNT-CONFIRMATION'); + case NotificationType.removeCredentialConfirmationType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.REMOVE-CREDENTIAL-CONFIRMATION'); + case NotificationType.dmpDepositType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.DMP-DEPOSIT'); + case NotificationType.descriptionTemplateInvitationType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.DESCRIPTION-TEMPLATE-INVITATION'); + case NotificationType.contactSupportType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.CONTACT-SUPPORT'); + case NotificationType.publicContactSupportType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.PUBLIC-CONTACT-SUPPORT'); default: return ''; } } - public toContactTypeString(value: ContactType): string { + public toContactTypeString(value: NotificationContactType): string { switch (value) { - case ContactType.Email: return this.language.instant('NOTIFICATION-SERVICE.TYPES.CONTACT-TYPE.EMAIL'); - case ContactType.SlackBroadcast: return this.language.instant('NOTIFICATION-SERVICE.TYPES.CONTACT-TYPE.SLACK-BROADCAST'); - case ContactType.Sms: return this.language.instant('NOTIFICATION-SERVICE.TYPES.CONTACT-TYPE.SMS'); - case ContactType.InApp: return this.language.instant('NOTIFICATION-SERVICE.TYPES.CONTACT-TYPE.IN-APP'); + case NotificationContactType.EMAIL: return this.language.instant('NOTIFICATION-SERVICE.TYPES.CONTACT-TYPE.EMAIL'); + case NotificationContactType.IN_APP: return this.language.instant('NOTIFICATION-SERVICE.TYPES.CONTACT-TYPE.IN-APP'); default: return ''; } } public toNotificationNotifyStateString(value: NotificationNotifyState): string { switch (value) { - case NotificationNotifyState.Pending: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-NOTIFY-STATE.PENDING'); - case NotificationNotifyState.Processing: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-NOTIFY-STATE.PROCESSING'); - case NotificationNotifyState.Successful: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-NOTIFY-STATE.SUCCESSFUL'); - case NotificationNotifyState.Error: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-NOTIFY-STATE.ERROR'); - case NotificationNotifyState.Omitted: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-NOTIFY-STATE.OMITTED'); + case NotificationNotifyState.PENDING: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-NOTIFY-STATE.PENDING'); + case NotificationNotifyState.PROCESSING: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-NOTIFY-STATE.PROCESSING'); + case NotificationNotifyState.SUCCESSFUL: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-NOTIFY-STATE.SUCCESSFUL'); + case NotificationNotifyState.ERROR: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-NOTIFY-STATE.ERROR'); + case NotificationNotifyState.OMITTED: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-NOTIFY-STATE.OMITTED'); default: return ''; } } public toNotificationTrackingStateString(value: NotificationTrackingState): string { switch (value) { - case NotificationTrackingState.Undefined: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-TRACKING-STATE.UNDEFINED'); - case NotificationTrackingState.NA: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-TRACKING-STATE.NA'); - case NotificationTrackingState.Queued: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-TRACKING-STATE.QUEUED'); - case NotificationTrackingState.Sent: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-TRACKING-STATE.SENT'); - case NotificationTrackingState.Delivered: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-TRACKING-STATE.DELIVERED'); - case NotificationTrackingState.Undelivered: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-TRACKING-STATE.UNDELIVERED'); - case NotificationTrackingState.Failed: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-TRACKING-STATE.FAILED'); - case NotificationTrackingState.Unsent: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-TRACKING-STATE.UNSENT'); + case NotificationTrackingState.UNDEFINED: return this.language.instant('TYPES.NOTIFICATION-TRACKING-STATE.UNDEFINED'); + case NotificationTrackingState.NA: return this.language.instant('TYPES.NOTIFICATION-TRACKING-STATE.NA'); + case NotificationTrackingState.QUEUED: return this.language.instant('TYPES.NOTIFICATION-TRACKING-STATE.QUEUED'); + case NotificationTrackingState.SENT: return this.language.instant('TYPES.NOTIFICATION-TRACKING-STATE.SENT'); + case NotificationTrackingState.DELIVERED: return this.language.instant('TYPES.NOTIFICATION-TRACKING-STATE.DELIVERED'); + case NotificationTrackingState.UNDELIVERED: return this.language.instant('TYPES.NOTIFICATION-TRACKING-STATE.UNDELIVERED'); + case NotificationTrackingState.FAILED: return this.language.instant('TYPES.NOTIFICATION-TRACKING-STATE.FAILED'); + case NotificationTrackingState.UNSENT: return this.language.instant('TYPES.NOTIFICATION-TRACKING-STATE.UNSENT'); default: return ''; } } public toNotificationTrackingProcessString(value: NotificationTrackingProcess): string { switch (value) { - case NotificationTrackingProcess.Pending: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-TRACKING-PROCESS.PENDING'); - case NotificationTrackingProcess.Processing: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-TRACKING-PROCESS.PROCESSING'); - case NotificationTrackingProcess.Completed: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-TRACKING-PROCESS.COMPLETED'); - case NotificationTrackingProcess.Error: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-TRACKING-PROCESS.ERROR'); - case NotificationTrackingProcess.Omitted: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-TRACKING-PROCESS.OMITTED'); + case NotificationTrackingProcess.PENDING: return this.language.instant('TYPES.NOTIFICATION-TRACKING-PROCESS.PENDING'); + case NotificationTrackingProcess.PROCESSING: return this.language.instant('TYPES.NOTIFICATION-TRACKING-PROCESS.PROCESSING'); + case NotificationTrackingProcess.SUCCESSFUL: return this.language.instant('TYPES.NOTIFICATION-TRACKING-PROCESS.SUCCESSFUL'); + case NotificationTrackingProcess.ERROR: return this.language.instant('TYPES.NOTIFICATION-TRACKING-PROCESS.ERROR'); + case NotificationTrackingProcess.OMITTED: return this.language.instant('TYPES.NOTIFICATION-TRACKING-PROCESS.OMITTED'); default: return ''; } } public toNotificationInAppTrackingString(value: NotificationInAppTracking): string { switch (value) { - case NotificationInAppTracking.Delivered: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-INAPP-TRACKING.DELIVERED'); - case NotificationInAppTracking.Stored: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-INAPP-TRACKING.STORED'); + case NotificationInAppTracking.Delivered: return this.language.instant('TYPES.NOTIFICATION-INAPP-TRACKING.DELIVERED'); + case NotificationInAppTracking.Stored: return this.language.instant('TYPES.NOTIFICATION-INAPP-TRACKING.STORED'); default: return ''; } } @@ -101,8 +99,6 @@ export class NotificationServiceEnumUtils extends BaseEnumUtilsService { public toNotificationChannelString(value: NotificationTemplateChannel): string { switch (value) { case NotificationTemplateChannel.Email: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-TEMPLATE-CHANNEL.EMAIL'); - case NotificationTemplateChannel.SlackBroadcast: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-TEMPLATE-CHANNEL.SLACK-BROADCAST'); - case NotificationTemplateChannel.Sms: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-TEMPLATE-CHANNEL.SMS'); case NotificationTemplateChannel.InApp: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-TEMPLATE-CHANNEL.IN-APP'); default: return ''; } @@ -110,11 +106,43 @@ export class NotificationServiceEnumUtils extends BaseEnumUtilsService { public toNotificationTemplateKindString(value: NotificationTemplateKind): string { switch (value) { - case NotificationTemplateKind.Default: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-TEMPLATE-KIND.DEFAULT'); - case NotificationTemplateKind.Primary: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-TEMPLATE-KIND.PRIMARY'); - case NotificationTemplateKind.Secondary: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-TEMPLATE-KIND.SECONDARY'); - case NotificationTemplateKind.Draft: return this.language.instant('NOTIFICATION-SERVICE.TYPES.NOTIFICATION-TEMPLATE-KIND.DRAFT'); + case NotificationTemplateKind.Draft: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-KIND.DRAFT'); + case NotificationTemplateKind.Secondary: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-KIND.SECONDARY'); + case NotificationTemplateKind.Primary: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-KIND.PRIMARY'); + case NotificationTemplateKind.Default: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-KIND.DEFAULT'); default: return ''; } } + + toNotificationTemplateChannelString(status: NotificationTemplateChannel): string { + switch (status) { + case NotificationTemplateChannel.Email: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-CHANNEL.EMAIL'); + case NotificationTemplateChannel.InApp: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-CHANNEL.INAPP'); + } + } + + toNotificationTemplateDataTypeString(status: NotificationDataType): string { + switch (status) { + case NotificationDataType.Integer: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-DATA-TYPE.INTEGER'); + case NotificationDataType.Demical: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-DATA-TYPE.DEMICAL'); + case NotificationDataType.Double: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-DATA-TYPE.DOUBLE'); + case NotificationDataType.DateTime: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-DATA-TYPE.DATE-TIME'); + case NotificationDataType.String: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-DATA-TYPE.STRING'); + } + } + + toEmailOverrideModeString(status: EmailOverrideMode): string { + switch (status) { + case EmailOverrideMode.NotOverride: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-EMAIL-OVERRIDE-MODE.NOT'); + case EmailOverrideMode.Additive: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-EMAIL-OVERRIDE-MODE.ADDITIVE'); + case EmailOverrideMode.Replace: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-EMAIL-OVERRIDE-MODE.REPLACE'); + } + } + + public toNotificationContactTypeString(value: NotificationContactType): string { + switch (value) { + case NotificationContactType.EMAIL: return this.language.instant('TYPES.NOTIFICATION-CONTACT-TYPE.EMAIL'); + case NotificationContactType.IN_APP: return this.language.instant('TYPES.NOTIFICATION-CONTACT-TYPE.INAPP'); + } + } } diff --git a/dmp-frontend/src/notification-service/core/formatting/formatting.module.ts b/dmp-frontend/src/notification-service/core/formatting/formatting.module.ts index 07a97677d..5a74a3ce7 100644 --- a/dmp-frontend/src/notification-service/core/formatting/formatting.module.ts +++ b/dmp-frontend/src/notification-service/core/formatting/formatting.module.ts @@ -1,9 +1,9 @@ -import { DatePipe } from '@angular/common'; -import { NgModule } from '@angular/core'; +import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core'; import { CommonFormattingModule } from '@common/formatting/common-formatting.module'; import { PipeService } from '@common/formatting/pipe.service'; import { IsActiveTypePipe } from '@notification-service/core/formatting/pipes/is-active-type.pipe'; import { NotificationInAppTrackingTypePipe } from '@notification-service/core/formatting/pipes/notification-inapp-tracking-type.pipe'; +import { NotificationServiceEnumUtils } from './enum-utils.service'; // // @@ -12,7 +12,7 @@ import { NotificationInAppTrackingTypePipe } from '@notification-service/core/fo // @NgModule({ imports: [ - CommonFormattingModule + CommonFormattingModule, ], declarations: [ IsActiveTypePipe, @@ -21,13 +21,13 @@ import { NotificationInAppTrackingTypePipe } from '@notification-service/core/fo exports: [ CommonFormattingModule, IsActiveTypePipe, - NotificationInAppTrackingTypePipe + NotificationInAppTrackingTypePipe, ], providers: [ PipeService, - DatePipe, IsActiveTypePipe, - NotificationInAppTrackingTypePipe + NotificationInAppTrackingTypePipe, + NotificationServiceEnumUtils ] }) export class NotificationServiceFormattingModule { } diff --git a/dmp-frontend/src/notification-service/core/model/inapp-notification.model.ts b/dmp-frontend/src/notification-service/core/model/inapp-notification.model.ts index a373bf6be..220652174 100644 --- a/dmp-frontend/src/notification-service/core/model/inapp-notification.model.ts +++ b/dmp-frontend/src/notification-service/core/model/inapp-notification.model.ts @@ -1,11 +1,11 @@ +import { User } from '@app/core/model/user/user'; import { Guid } from '@common/types/guid'; import { IsActive } from '@notification-service/core/enum/is-active.enum'; import { NotificationInAppTracking } from '@notification-service/core/enum/notification-inapp-tracking.enum'; -import { NotificationServiceUser } from '@notification-service/core/model/user.model'; export interface InAppNotification { id: Guid; - user: NotificationServiceUser; + user: User; isActive: IsActive; type: Guid; trackingState: NotificationInAppTracking; diff --git a/dmp-frontend/src/notification-service/core/model/notification-template.model.ts b/dmp-frontend/src/notification-service/core/model/notification-template.model.ts index c68e86ff3..d1c7067f9 100644 --- a/dmp-frontend/src/notification-service/core/model/notification-template.model.ts +++ b/dmp-frontend/src/notification-service/core/model/notification-template.model.ts @@ -3,46 +3,87 @@ import { IsActive } from '@notification-service/core/enum/is-active.enum'; import { NotificationTemplateChannel } from '@notification-service/core/enum/notification-template-channel.enum'; import { NotificationTemplateKind } from '@notification-service/core/enum/notification-template-kind.enum'; import { NotificationType } from '@notification-service/core/enum/notification-type.enum'; +import { EmailOverrideMode } from '../enum/email-override-mode'; +import { NotificationDataType } from '../enum/notification-data-type'; export interface NotificationTemplate { - id: Guid; + id?: Guid; channel: NotificationTemplateChannel; notificationType: NotificationType; kind: NotificationTemplateKind; - language: string; - description: string; + languageCode: string; value: NotificationTemplateValue; - isActive: IsActive; - createdAt: Date; - updatedAt: Date; - hash: string; + isActive?: IsActive; + createdAt?: Date; + updatedAt?: Date; + hash?: string; + belongsToCurrentTenant?: boolean; } export interface NotificationTemplateValue { subjectText: string; + subjectKey: string; subjectFieldOptions: NotificationFieldOptions; bodyText: string; + bodyKey: string; + priorityKey: string; + allowAttachments: Boolean; + cc: string[]; + ccMode: EmailOverrideMode; + bcc: string[]; + bccMode: EmailOverrideMode; + extraDataKeys: string[]; bodyFieldOptions: NotificationFieldOptions; } export interface NotificationFieldOptions { mandatory?: string[]; - options?: NotificationFieldInfo[]; + optional?: NotificationFieldInfo[]; formatting?: { [key: string]: string }; } export interface NotificationFieldInfo { key: string; + type: NotificationDataType, value: string; } +// Persist + export interface NotificationTemplatePersist { id?: Guid; channel: NotificationTemplateChannel; notificationType: NotificationType; kind: NotificationTemplateKind; - language: string; - description: string; - value: NotificationTemplateValue; + languageCode: string; + value: NotificationTemplateValuePersist; hash?: string; } + +export interface NotificationTemplateValuePersist { + subjectText: string; + subjectKey: string; + subjectFieldOptions: NotificationFieldOptionsPersist; + bodyText: string; + bodyKey: string; + priorityKey: string; + allowAttachments: Boolean; + cc: string[]; + ccMode: EmailOverrideMode; + bcc: string[]; + bccMode: EmailOverrideMode; + extraDataKeys: string[]; + bodyFieldOptions: NotificationFieldOptionsPersist; +} + +export interface NotificationFieldOptionsPersist { + mandatory?: string[]; + optional?: NotificationFieldInfoPersist[]; + formatting?: { [key: string]: string }; +} + +export interface NotificationFieldInfoPersist { + key: string; + type: NotificationDataType, + value: string; +} diff --git a/dmp-frontend/src/notification-service/core/model/notification.model.ts b/dmp-frontend/src/notification-service/core/model/notification.model.ts index 7edaf49ec..0f5260522 100644 --- a/dmp-frontend/src/notification-service/core/model/notification.model.ts +++ b/dmp-frontend/src/notification-service/core/model/notification.model.ts @@ -1,30 +1,29 @@ +import { User } from '@app/core/model/user/user'; import { Guid } from '@common/types/guid'; -import { ContactType } from '@notification-service/core/enum/contact-type.enum'; import { IsActive } from '@notification-service/core/enum/is-active.enum'; import { NotificationNotifyState } from '@notification-service/core/enum/notification-notify-state.enum'; import { NotificationTrackingProcess } from '@notification-service/core/enum/notification-tracking-process.enum'; import { NotificationTrackingState } from '@notification-service/core/enum/notification-tracking-state.enum'; import { NotificationType } from '@notification-service/core/enum/notification-type.enum'; -import { NotificationServiceUser } from '@notification-service/core/model/user.model'; +import { NotificationContactType } from '../enum/notification-contact-type'; export interface Notification { - id: Guid; - user: NotificationServiceUser; - isActive: IsActive; + id?: Guid; + user: User; type: NotificationType; - contactType: ContactType; + contactTypeHint: NotificationContactType; contactHint: string; data: string; notifyState: NotificationNotifyState; - notifiedWith: ContactType; + notifiedWith: NotificationContactType; notifiedAt: Date; retryCount: number; trackingState: NotificationTrackingState; trackingProcess: NotificationTrackingProcess; trackingData: string; - provenanceType: NotificationType; - provenanceRef: string; - createdAt: Date; - updatedAt: Date; - hash: string; + isActive?: IsActive; + createdAt?: Date; + updatedAt?: Date; + hash?: string; + belongsToCurrentTenant?: boolean; } diff --git a/dmp-frontend/src/notification-service/core/model/notifier-configuration.model.ts b/dmp-frontend/src/notification-service/core/model/notifier-configuration.model.ts new file mode 100644 index 000000000..21b2c202e --- /dev/null +++ b/dmp-frontend/src/notification-service/core/model/notifier-configuration.model.ts @@ -0,0 +1,5 @@ +import { NotificationContactType } from '@notification-service/core/enum/notification-contact-type'; + +export interface NotifierListConfigurationDataContainer { + notifiers: { [key: string]: NotificationContactType[] }; +} diff --git a/dmp-frontend/src/notification-service/core/model/tenant-configuration.model.ts b/dmp-frontend/src/notification-service/core/model/tenant-configuration.model.ts deleted file mode 100644 index 367faef74..000000000 --- a/dmp-frontend/src/notification-service/core/model/tenant-configuration.model.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { Guid } from '@common/types/guid'; -import { ContactType } from '@notification-service/core/enum/contact-type.enum'; -import { TenantConfigurationType } from '@notification-service/core/enum/tenant-configuration-type.enum'; - -export interface TenantConfiguration { - id?: Guid; - type: TenantConfigurationType; - value: string; - slackBroadcastData: SlackBroadcastDataContainer; - emailClientData: EmailClientConfigurationDataContainer; - smsClientData: SmsClientConfigurationDataContainer; - notifierListData: NotifierListConfigurationDataContainer; - createdAt?: Date; - updatedAt?: Date; - hash: string; -} - -// -// Slack Broadcast -// -export interface SlackBroadcastDataContainer { - webhooks: SlackBroadcastWebhookInfo[]; -} - -export interface TenantConfigurationSlackBroadcastPersist { - id?: Guid; - hash?: string; - webhooks: SlackBroadcastWebhookInfo[]; -} - -export interface SlackBroadcastWebhookInfo { - id: Guid; - name: string; - webhook: string; -} - -// -// Email Client Configuration -// -export interface EmailClientConfigurationDataContainer { - requiresCredentials: boolean; - enableSSL: boolean; - hostServer: string; - hostPortNo: number; - emailAddress: string; - emailUsername: string; - emailPassword: string; -} - -export interface TenantConfigurationEmailClientPersist { - id?: Guid; - hash?: string; - requiresCredentials: boolean; - enableSSL: boolean; - hostServer: string; - hostPortNo: number; - emailAddress: string; - emailUsername: string; - emailPassword: string; -} - -// -// Sms Client -// -export interface SmsClientConfigurationDataContainer { - applicationId: string; - applicationSecret: string; - sendAsName: string; -} - -export interface TenantConfigurationSmsClientPersist { - id?: Guid; - hash?: string; - applicationId: string; - applicationSecret: string; - sendAsName: string; -} - -// -// Notifier List -// -export interface NotifierListConfigurationDataContainer { - notifiers: { [key: string]: ContactType[] }; -} - -export interface TenantConfigurationNotifierListPersist { - id?: Guid; - hash?: string; - notifiers: { [key: string]: ContactType[] }; -} - - diff --git a/dmp-frontend/src/notification-service/core/model/user-notification-preference.model.ts b/dmp-frontend/src/notification-service/core/model/user-notification-preference.model.ts index e49c1ad1b..759b1f5c9 100644 --- a/dmp-frontend/src/notification-service/core/model/user-notification-preference.model.ts +++ b/dmp-frontend/src/notification-service/core/model/user-notification-preference.model.ts @@ -1,16 +1,16 @@ import { Guid } from '@common/types/guid'; -import { ContactType } from '@notification-service/core/enum/contact-type.enum'; import { NotificationType } from '@notification-service/core/enum/notification-type.enum'; +import { NotificationContactType } from '../enum/notification-contact-type'; export interface UserNotificationPreference { userId?: Guid; type: NotificationType; - channel: ContactType; + channel: NotificationContactType; ordinal: number; createdAt?: Date; } export interface UserNotificationPreferencePersist { userId?: Guid; - notificationPreferences: { [key: string]: ContactType[] }; + notificationPreferences: { [key: string]: NotificationContactType[] }; } diff --git a/dmp-frontend/src/notification-service/core/model/user.model.ts b/dmp-frontend/src/notification-service/core/model/user.model.ts deleted file mode 100644 index fac532e8f..000000000 --- a/dmp-frontend/src/notification-service/core/model/user.model.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { Guid } from '@common/types/guid'; -import { ContactInfoType } from '@notification-service/core/enum/contact-info-type.enum'; -import { IsActive } from '@notification-service/core/enum/is-active.enum'; - -export interface NotificationServiceUser { - id: Guid; - isActive?: IsActive; - createdAt?: Date; - updatedAt?: Date; - hash: string; - contacts: NotificationServiceContactInfo[]; - profile: NotificationServiceUserProfile; -} - -export interface NotificationServiceContactInfo { - id: Guid; - user: NotificationServiceUser; - type?: ContactInfoType; - isActive?: IsActive; - value: string; - ordinal: number; - createdAt?: Date; - updatedAt?: Date; - hash: string; -} - -export interface NotificationServiceUserProfile { - id: Guid; - timezone: string; - culture?: string; - language: string; - createdAt?: Date; - updatedAt?: Date; - hash: string; - users: NotificationServiceUser[]; -} diff --git a/dmp-frontend/src/app/core/query/inapp-notification.lookup.ts b/dmp-frontend/src/notification-service/core/query/inapp-notification.lookup.ts similarity index 61% rename from dmp-frontend/src/app/core/query/inapp-notification.lookup.ts rename to dmp-frontend/src/notification-service/core/query/inapp-notification.lookup.ts index e4ae69cfe..b51d2518f 100644 --- a/dmp-frontend/src/app/core/query/inapp-notification.lookup.ts +++ b/dmp-frontend/src/notification-service/core/query/inapp-notification.lookup.ts @@ -1,7 +1,7 @@ import { Lookup } from '@common/model/lookup'; -import { NotificationType } from '../common/enum/notification-type'; -import { NotificationInAppTracking } from '../common/enum/notification-inapp-tracking.enum'; -import { IsActive } from '../common/enum/is-active.enum'; +import { IsActive } from '@notification-service/core/enum/is-active.enum'; +import { NotificationInAppTracking } from '@notification-service/core/enum/notification-inapp-tracking.enum'; +import { NotificationType } from '@notification-service/core/enum/notification-type.enum'; export class InAppNotificationLookup extends Lookup implements InAppNotificationFilter { like: string; diff --git a/dmp-frontend/src/app/core/query/notification-template.lookup.ts b/dmp-frontend/src/notification-service/core/query/notification-template.lookup.ts similarity index 61% rename from dmp-frontend/src/app/core/query/notification-template.lookup.ts rename to dmp-frontend/src/notification-service/core/query/notification-template.lookup.ts index 7fdaa95ce..aa71d8e8f 100644 --- a/dmp-frontend/src/app/core/query/notification-template.lookup.ts +++ b/dmp-frontend/src/notification-service/core/query/notification-template.lookup.ts @@ -1,9 +1,9 @@ import { Lookup } from "@common/model/lookup"; import { Guid } from "@common/types/guid"; -import { IsActive } from "../common/enum/is-active.enum"; -import { NotificationTemplateKind } from "../common/enum/notification-template-kind"; -import { NotificationTemplateChannel } from "../common/enum/notification-template-channel"; -import { NotificationType } from "../common/enum/notification-type"; +import { IsActive } from "@notification-service/core/enum/is-active.enum"; +import { NotificationTemplateChannel } from "@notification-service/core/enum/notification-template-channel.enum"; +import { NotificationTemplateKind } from "@notification-service/core/enum/notification-template-kind.enum"; +import { NotificationType } from "@notification-service/core/enum/notification-type.enum"; export class NotificationTemplateLookup extends Lookup implements NotificationTemplateFilter { ids: Guid[]; diff --git a/dmp-frontend/src/app/core/query/notification.lookup.ts b/dmp-frontend/src/notification-service/core/query/notification.lookup.ts similarity index 59% rename from dmp-frontend/src/app/core/query/notification.lookup.ts rename to dmp-frontend/src/notification-service/core/query/notification.lookup.ts index 3ac6f12cc..e01281314 100644 --- a/dmp-frontend/src/app/core/query/notification.lookup.ts +++ b/dmp-frontend/src/notification-service/core/query/notification.lookup.ts @@ -1,11 +1,11 @@ import { Lookup } from "@common/model/lookup"; import { Guid } from "@common/types/guid"; -import { IsActive } from "../common/enum/is-active.enum"; -import { NotificationType } from "../common/enum/notification-type"; -import { NotificationNotifyState } from "../common/enum/notification-notify-state"; -import { NotificationContactType } from "../common/enum/notification-contact-type"; -import { NotificationTrackingState } from "../common/enum/notification-tracking-state"; -import { NotificationTrackingProcess } from "../common/enum/notification-tracking-process"; +import { IsActive } from "@notification-service/core/enum/is-active.enum"; +import { NotificationContactType } from "@notification-service/core/enum/notification-contact-type"; +import { NotificationNotifyState } from "@notification-service/core/enum/notification-notify-state.enum"; +import { NotificationTrackingProcess } from "@notification-service/core/enum/notification-tracking-process.enum"; +import { NotificationTrackingState } from "@notification-service/core/enum/notification-tracking-state.enum"; +import { NotificationType } from "@notification-service/core/enum/notification-type.enum"; export class NotificationLookup extends Lookup implements NotificationFilter { ids: Guid[]; diff --git a/dmp-frontend/src/notification-service/core/query/tenant-configuration.lookup.ts b/dmp-frontend/src/notification-service/core/query/tenant-configuration.lookup.ts deleted file mode 100644 index 5ae3688a8..000000000 --- a/dmp-frontend/src/notification-service/core/query/tenant-configuration.lookup.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { Lookup } from '@common/model/lookup'; -import { Guid } from '@common/types/guid'; -import { IsActive } from '@notification-service/core/enum/is-active.enum'; -import { TenantConfigurationType } from '@notification-service/core/enum/tenant-configuration-type.enum'; - -export class TenantConfigurationLookup extends Lookup implements TenantConfigurationFilter { - ids?: Guid[]; - excludedIds?: Guid[]; - isActive?: IsActive[]; - type?: TenantConfigurationType[]; - - constructor() { - super(); - } -} - -export interface TenantConfigurationFilter { - ids?: Guid[]; - excludedIds?: Guid[]; - isActive?: IsActive[]; - type?: TenantConfigurationType[]; -} diff --git a/dmp-frontend/src/notification-service/core/query/user-notification-preference.lookup.ts b/dmp-frontend/src/notification-service/core/query/user-notification-preference.lookup.ts index 0a1ceef9b..f1f57be1e 100644 --- a/dmp-frontend/src/notification-service/core/query/user-notification-preference.lookup.ts +++ b/dmp-frontend/src/notification-service/core/query/user-notification-preference.lookup.ts @@ -1,12 +1,12 @@ import { Lookup } from '@common/model/lookup'; import { Guid } from '@common/types/guid'; -import { ContactType } from '@notification-service/core/enum/contact-type.enum'; import { NotificationType } from '@notification-service/core/enum/notification-type.enum'; +import { NotificationContactType } from '../enum/notification-contact-type'; export class UserNotificationPreferenceLookup extends Lookup implements UserNotificationPreferenceFilter { userIds?: Guid[]; type?: NotificationType[]; - channel?: ContactType[]; + channel?: NotificationContactType[]; constructor() { super(); @@ -16,5 +16,5 @@ export class UserNotificationPreferenceLookup extends Lookup implements UserNoti export interface UserNotificationPreferenceFilter { userIds?: Guid[]; type?: NotificationType[]; - channel?: ContactType[]; + channel?: NotificationContactType[]; } diff --git a/dmp-frontend/src/notification-service/services/core-service.module.ts b/dmp-frontend/src/notification-service/services/core-service.module.ts index 7ca5f6c74..b79792d08 100644 --- a/dmp-frontend/src/notification-service/services/core-service.module.ts +++ b/dmp-frontend/src/notification-service/services/core-service.module.ts @@ -7,6 +7,9 @@ import { LoggingService } from '@app/core/services/logging/logging-service'; import { FilterService } from '@common/modules/text-filter/filter-service'; import { PrincipalService } from '@app/core/services/http/principal.service'; import { NotificationServiceEnumUtils } from '@notification-service/core/formatting/enum-utils.service'; +import { InAppNotificationService } from './http/inapp-notification.service'; +import { NotificationService } from './http/notification-service'; +import { NotificationTemplateService } from './http/notification-template.service'; // // @@ -32,6 +35,9 @@ export class CoreNotificationServiceModule { FilterService, LoggingService, PrincipalService, + NotificationService, + InAppNotificationService, + NotificationTemplateService, UserNotificationPreferenceService ], }; diff --git a/dmp-frontend/src/app/core/services/inapp-notification/inapp-notification.service.ts b/dmp-frontend/src/notification-service/services/http/inapp-notification.service.ts similarity index 85% rename from dmp-frontend/src/app/core/services/inapp-notification/inapp-notification.service.ts rename to dmp-frontend/src/notification-service/services/http/inapp-notification.service.ts index bcc3c2855..acbae0652 100644 --- a/dmp-frontend/src/app/core/services/inapp-notification/inapp-notification.service.ts +++ b/dmp-frontend/src/notification-service/services/http/inapp-notification.service.ts @@ -1,14 +1,14 @@ import { Injectable } from '@angular/core'; -import { InAppNotification } from '@app/core/model/inapp-notification/inapp-notification.model'; -import { InAppNotificationLookup } from '@app/core/query/inapp-notification.lookup'; +import { catchError } from 'rxjs/operators'; +import { Observable, throwError } from 'rxjs'; import { BaseHttpParams } from '@common/http/base-http-params'; import { InterceptorType } from '@common/http/interceptors/interceptor-type'; import { QueryResult } from '@common/model/query-result'; import { Guid } from '@common/types/guid'; -import { Observable, throwError } from 'rxjs'; -import { catchError } from 'rxjs/operators'; -import { BaseHttpV2Service } from '../http/base-http-v2.service'; -import { ConfigurationService } from '../configuration/configuration.service'; +import { InAppNotification } from '@notification-service/core/model/inapp-notification.model'; +import { InAppNotificationLookup } from '@notification-service/core/query/inapp-notification.lookup'; +import { BaseHttpV2Service } from '@app/core/services/http/base-http-v2.service'; +import { ConfigurationService } from '@app/core/services/configuration/configuration.service'; @Injectable() export class InAppNotificationService { diff --git a/dmp-frontend/src/app/core/services/notification/notification-service.ts b/dmp-frontend/src/notification-service/services/http/notification-service.ts similarity index 72% rename from dmp-frontend/src/app/core/services/notification/notification-service.ts rename to dmp-frontend/src/notification-service/services/http/notification-service.ts index 59fba800c..d9e1ea8d3 100644 --- a/dmp-frontend/src/app/core/services/notification/notification-service.ts +++ b/dmp-frontend/src/notification-service/services/http/notification-service.ts @@ -1,12 +1,12 @@ import { Injectable } from '@angular/core'; -import { QueryResult } from '@common/model/query-result'; -import { Guid } from '@common/types/guid'; -import { NotificationLookup } from '@app/core/query/notification.lookup'; import { Observable, throwError } from 'rxjs'; import { catchError } from 'rxjs/operators'; -import { Notification } from '@app/core/model/notification/notification.model'; -import { BaseHttpV2Service } from '../http/base-http-v2.service'; -import { ConfigurationService } from '../configuration/configuration.service'; +import { Guid } from '@common/types/guid'; +import { QueryResult } from '@common/model/query-result'; +import { NotificationLookup } from '@notification-service/core/query/notification.lookup'; +import { Notification } from '@notification-service/core/model/notification.model'; +import { BaseHttpV2Service } from '@app/core/services/http/base-http-v2.service'; +import { ConfigurationService } from '@app/core/services/configuration/configuration.service'; @Injectable() export class NotificationService { diff --git a/dmp-frontend/src/app/core/services/notification-template/notification-template.service.ts b/dmp-frontend/src/notification-service/services/http/notification-template.service.ts similarity index 80% rename from dmp-frontend/src/app/core/services/notification-template/notification-template.service.ts rename to dmp-frontend/src/notification-service/services/http/notification-template.service.ts index a8fdd3df0..5e6436900 100644 --- a/dmp-frontend/src/app/core/services/notification-template/notification-template.service.ts +++ b/dmp-frontend/src/notification-service/services/http/notification-template.service.ts @@ -1,13 +1,13 @@ import { Injectable } from '@angular/core'; -import { QueryResult } from '@common/model/query-result'; -import { Guid } from '@common/types/guid'; -import { NotificationTemplateKind } from '@app/core/common/enum/notification-template-kind'; -import { NotificationTemplateLookup } from '@app/core/query/notification-template.lookup'; import { Observable, throwError } from 'rxjs'; import { catchError } from 'rxjs/operators'; -import { NotificationTemplate, NotificationTemplatePersist } from '@app/core/model/notification-template/notification-template'; -import { BaseHttpV2Service } from '../http/base-http-v2.service'; -import { ConfigurationService } from '../configuration/configuration.service'; +import { QueryResult } from '@common/model/query-result'; +import { Guid } from '@common/types/guid'; +import { NotificationTemplateLookup } from '@notification-service/core/query/notification-template.lookup'; +import { NotificationTemplate, NotificationTemplatePersist } from '@notification-service/core/model/notification-template.model'; +import { NotificationTemplateKind } from '@notification-service/core/enum/notification-template-kind.enum'; +import { BaseHttpV2Service } from '@app/core/services/http/base-http-v2.service'; +import { ConfigurationService } from '@app/core/services/configuration/configuration.service'; @Injectable() export class NotificationTemplateService { diff --git a/dmp-frontend/src/notification-service/services/http/user-notification-preference.service.ts b/dmp-frontend/src/notification-service/services/http/user-notification-preference.service.ts index 70159ce87..a5a18df5f 100644 --- a/dmp-frontend/src/notification-service/services/http/user-notification-preference.service.ts +++ b/dmp-frontend/src/notification-service/services/http/user-notification-preference.service.ts @@ -1,15 +1,12 @@ -import { HttpHeaders } from '@angular/common/http'; import { Injectable } from '@angular/core'; -import { ConfigurationService } from '@app/core/services/configuration/configuration.service'; -import { BaseHttpV2Service } from '@app/core/services/http/base-http-v2.service'; -import { QueryResult } from '@common/model/query-result'; -import { Guid } from '@common/types/guid'; -import { NotifierListConfigurationDataContainer } from '@notification-service/core/model/tenant-configuration.model'; -import { UserNotificationPreference, UserNotificationPreferencePersist } from '@notification-service/core/model/user-notification-preference.model'; -import { NotifierListLookup } from '@notification-service/core/query/notifier-list.lookup'; -import { UserNotificationPreferenceLookup } from '@notification-service/core/query/user-notification-preference.lookup'; import { Observable, throwError } from 'rxjs'; import { catchError } from 'rxjs/operators'; +import { Guid } from '@common/types/guid'; +import { NotifierListLookup } from '@notification-service/core/query/notifier-list.lookup'; +import { NotifierListConfigurationDataContainer } from '@notification-service/core/model/notifier-configuration.model'; +import { UserNotificationPreference, UserNotificationPreferencePersist } from '@notification-service/core/model/user-notification-preference.model'; +import { BaseHttpV2Service } from '@app/core/services/http/base-http-v2.service'; +import { ConfigurationService } from '@app/core/services/configuration/configuration.service'; @Injectable() export class UserNotificationPreferenceService { @@ -21,13 +18,6 @@ export class UserNotificationPreferenceService { private http: BaseHttpV2Service ) { } - query(q: UserNotificationPreferenceLookup): Observable> { - const url = `${this.apiBase}/query`; - return this.http - .post>(url, q).pipe( - catchError((error: any) => throwError(error))); - } - current(id: Guid, reqFields: string[] = []): Observable { const url = `${this.apiBase}/user/${id}/current`; const options = { params: { f: reqFields } }; @@ -47,11 +37,9 @@ export class UserNotificationPreferenceService { persist(item: UserNotificationPreferencePersist, totp?: string): Observable { const url = `${this.apiBase}/persist`; - let headers = new HttpHeaders(); - // if (totp) { headers = headers.set(this.configurationService.authTotpHeader, totp); } return this.http - .post(url, item, headers ? { headers: headers } : undefined).pipe( + .post(url, item).pipe( catchError((error: any) => throwError(error))); return; } diff --git a/dmp-frontend/src/app/ui/admin/notification-template/editor/field-options/notification-template-field-options.component.html b/dmp-frontend/src/notification-service/ui/admin/notification-template/editor/field-options/notification-template-field-options.component.html similarity index 100% rename from dmp-frontend/src/app/ui/admin/notification-template/editor/field-options/notification-template-field-options.component.html rename to dmp-frontend/src/notification-service/ui/admin/notification-template/editor/field-options/notification-template-field-options.component.html diff --git a/dmp-frontend/src/app/ui/admin/notification-template/editor/field-options/notification-template-field-options.component.scss b/dmp-frontend/src/notification-service/ui/admin/notification-template/editor/field-options/notification-template-field-options.component.scss similarity index 100% rename from dmp-frontend/src/app/ui/admin/notification-template/editor/field-options/notification-template-field-options.component.scss rename to dmp-frontend/src/notification-service/ui/admin/notification-template/editor/field-options/notification-template-field-options.component.scss diff --git a/dmp-frontend/src/app/ui/admin/notification-template/editor/field-options/notification-template-field-options.component.ts b/dmp-frontend/src/notification-service/ui/admin/notification-template/editor/field-options/notification-template-field-options.component.ts similarity index 97% rename from dmp-frontend/src/app/ui/admin/notification-template/editor/field-options/notification-template-field-options.component.ts rename to dmp-frontend/src/notification-service/ui/admin/notification-template/editor/field-options/notification-template-field-options.component.ts index 6653ddc78..ec6eb97d7 100644 --- a/dmp-frontend/src/app/ui/admin/notification-template/editor/field-options/notification-template-field-options.component.ts +++ b/dmp-frontend/src/notification-service/ui/admin/notification-template/editor/field-options/notification-template-field-options.component.ts @@ -1,12 +1,12 @@ import { Component, Input, OnInit } from '@angular/core'; import { UntypedFormArray } from '@angular/forms'; -import { NotificationDataType } from '@app/core/common/enum/notification-data-type'; import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; import { BaseComponent } from '@common/base/base.component'; import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model'; import { NotificationFieldInfoEditorModel, NotificationFieldOptionsEditorModel } from '../notification-template-editor.model'; import { MatChipEditedEvent, MatChipInputEvent } from '@angular/material/chips'; import { COMMA, ENTER } from '@angular/cdk/keycodes'; +import { NotificationDataType } from '@notification-service/core/enum/notification-data-type'; @Component({ selector: 'app-notification-template-field-options-component', diff --git a/dmp-frontend/src/app/ui/admin/notification-template/editor/notification-template-editor.component.html b/dmp-frontend/src/notification-service/ui/admin/notification-template/editor/notification-template-editor.component.html similarity index 100% rename from dmp-frontend/src/app/ui/admin/notification-template/editor/notification-template-editor.component.html rename to dmp-frontend/src/notification-service/ui/admin/notification-template/editor/notification-template-editor.component.html diff --git a/dmp-frontend/src/app/ui/admin/notification-template/editor/notification-template-editor.component.scss b/dmp-frontend/src/notification-service/ui/admin/notification-template/editor/notification-template-editor.component.scss similarity index 100% rename from dmp-frontend/src/app/ui/admin/notification-template/editor/notification-template-editor.component.scss rename to dmp-frontend/src/notification-service/ui/admin/notification-template/editor/notification-template-editor.component.scss diff --git a/dmp-frontend/src/app/ui/admin/notification-template/editor/notification-template-editor.component.ts b/dmp-frontend/src/notification-service/ui/admin/notification-template/editor/notification-template-editor.component.ts similarity index 92% rename from dmp-frontend/src/app/ui/admin/notification-template/editor/notification-template-editor.component.ts rename to dmp-frontend/src/notification-service/ui/admin/notification-template/editor/notification-template-editor.component.ts index 76abf2eb2..306bbe72a 100644 --- a/dmp-frontend/src/app/ui/admin/notification-template/editor/notification-template-editor.component.ts +++ b/dmp-frontend/src/notification-service/ui/admin/notification-template/editor/notification-template-editor.component.ts @@ -7,10 +7,9 @@ import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service'; import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service'; import { TranslateService } from '@ngx-translate/core'; -import { NotificationTemplateKind } from '@app/core/common/enum/notification-template-kind'; import { AppPermission } from '@app/core/common/enum/permission.enum'; -import { NotificationTemplate, NotificationTemplatePersist } from '@app/core/model/notification-template/notification-template'; -import { NotificationTemplateService } from '@app/core/services/notification-template/notification-template.service'; +import { NotificationTemplate, NotificationTemplatePersist } from '@notification-service/core/model/notification-template.model'; +import { NotificationTemplateService } from '@notification-service/services/http/notification-template.service'; import { NotificationFieldInfoEditorModel, NotificationFieldOptionsEditorModel, NotificationTemplateEditorModel } from './notification-template-editor.model'; import { map, takeUntil } from 'rxjs/operators'; import { BaseEditor } from '@common/base/base-editor'; @@ -18,24 +17,25 @@ import { ActivatedRoute, Router } from '@angular/router'; import { FilterService } from '@common/modules/text-filter/filter-service'; import { DatePipe } from '@angular/common'; import { QueryParamsService } from '@app/core/services/utilities/query-params.service'; -import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; +import { NotificationServiceEnumUtils } from '@notification-service/core/formatting/enum-utils.service'; import { MatomoService } from '@app/core/services/matomo/matomo-service'; import { NotificationTemplateEditorService } from './notification-template-editor.service'; import { Guid } from '@common/types/guid'; import { NotificationTemplateEditorResolver } from './notification-template-editor.resolver'; -import { IsActive } from '@app/core/common/enum/is-active.enum'; import { LoggingService } from '@app/core/services/logging/logging-service'; import { LanguageHttpService } from '@app/core/services/language/language.http.service'; import { Language } from '@app/core/model/language/language'; import { nameof } from 'ts-simple-nameof'; -import { NotificationTemplateChannel } from '@app/core/common/enum/notification-template-channel'; import { MatChipEditedEvent, MatChipInputEvent } from '@angular/material/chips'; import { MatCheckboxChange } from '@angular/material/checkbox'; -import { NotificationDataType } from '@app/core/common/enum/notification-data-type'; -import { EmailOverrideMode } from '@app/core/common/enum/email-override-mode'; -import { NotificationType } from '@app/core/common/enum/notification-type'; import { ConfigurationService } from '@app/core/services/configuration/configuration.service'; import { LockService } from '@app/core/services/lock/lock.service'; +import { IsActive } from '@notification-service/core/enum/is-active.enum'; +import { NotificationTemplateChannel } from '@notification-service/core/enum/notification-template-channel.enum'; +import { NotificationTemplateKind } from '@notification-service/core/enum/notification-template-kind.enum'; +import { NotificationType } from '@notification-service/core/enum/notification-type.enum'; +import { EmailOverrideMode } from '@notification-service/core/enum/email-override-mode'; +import { NotificationDataType } from '@notification-service/core/enum/notification-data-type'; @Component({ selector: 'app-notification-template-editor', @@ -93,7 +93,7 @@ export class NotificationTemplateEditorComponent extends BaseEditor -
diff --git a/dmp-frontend/src/app/ui/inapp-notification/listing/mine-inapp-notification-listing.component.scss b/dmp-frontend/src/notification-service/ui/inapp-notification/listing/mine-inapp-notification-listing.component.scss similarity index 100% rename from dmp-frontend/src/app/ui/inapp-notification/listing/mine-inapp-notification-listing.component.scss rename to dmp-frontend/src/notification-service/ui/inapp-notification/listing/mine-inapp-notification-listing.component.scss diff --git a/dmp-frontend/src/app/ui/inapp-notification/listing/mine-inapp-notification-listing.component.ts b/dmp-frontend/src/notification-service/ui/inapp-notification/listing/mine-inapp-notification-listing.component.ts similarity index 90% rename from dmp-frontend/src/app/ui/inapp-notification/listing/mine-inapp-notification-listing.component.ts rename to dmp-frontend/src/notification-service/ui/inapp-notification/listing/mine-inapp-notification-listing.component.ts index 72efce277..f6876d56c 100644 --- a/dmp-frontend/src/app/ui/inapp-notification/listing/mine-inapp-notification-listing.component.ts +++ b/dmp-frontend/src/notification-service/ui/inapp-notification/listing/mine-inapp-notification-listing.component.ts @@ -8,21 +8,21 @@ import { DataTableDateTimeFormatPipe } from '@common/formatting/pipes/date-time- import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service'; import { ColumnDefinition, ColumnsChangedEvent, HybridListingComponent, PageLoadEvent } from '@common/modules/hybrid-listing/hybrid-listing.component'; import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service'; -import { InAppNotification } from '@app/core/model/inapp-notification/inapp-notification.model'; -import { InAppNotificationLookup } from '@app/core/query/inapp-notification.lookup'; -import { InAppNotificationService } from '@app/core/services/inapp-notification/inapp-notification.service'; +import { InAppNotificationLookup } from '@notification-service/core/query/inapp-notification.lookup'; +import { InAppNotificationService } from '@notification-service/services/http/inapp-notification.service'; import { IsActive } from '@app/core/common/enum/is-active.enum'; import { nameof } from 'ts-simple-nameof'; import { Observable } from 'rxjs'; import { QueryResult } from '@common/model/query-result'; -import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; +import { NotificationServiceEnumUtils } from '@notification-service/core/formatting/enum-utils.service'; import { TranslateService } from '@ngx-translate/core'; import { MatDialog } from '@angular/material/dialog'; import { Guid } from '@common/types/guid'; import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component'; import { takeUntil } from 'rxjs/operators'; -import { NotificationInAppTracking } from '@app/core/common/enum/notification-inapp-tracking.enum'; import { NotificationTypePipe } from '@common/formatting/pipes/notification-type.pipe'; +import { NotificationInAppTracking } from '@notification-service/core/enum/notification-inapp-tracking.enum'; +import { InAppNotification } from '@notification-service/core/model/inapp-notification.model'; @Component({ selector: 'app-mine-inapp-notification-listing', @@ -59,7 +59,7 @@ export class MineInAppNotificationListingComponent extends BaseListingComponent< private inAppNotificationService: InAppNotificationService, public authService: AuthService, private pipeService: PipeService, - public enumUtils: EnumUtils, + public enumUtils: NotificationServiceEnumUtils, private language: TranslateService, private dialog: MatDialog ) { @@ -74,6 +74,9 @@ export class MineInAppNotificationListingComponent extends BaseListingComponent< } protected initializeLookup(): InAppNotificationLookup { + console.log('this.enumUtils'); + console.log(this.enumUtils); + console.log(this.inAppNotificationService); const lookup = new InAppNotificationLookup(); lookup.metadata = { countAll: true }; lookup.page = { offset: 0, size: this.ITEMS_PER_PAGE }; diff --git a/dmp-frontend/src/app/ui/inapp-notification/mine-inapp-notification-routing.module.ts b/dmp-frontend/src/notification-service/ui/inapp-notification/mine-inapp-notification-routing.module.ts similarity index 100% rename from dmp-frontend/src/app/ui/inapp-notification/mine-inapp-notification-routing.module.ts rename to dmp-frontend/src/notification-service/ui/inapp-notification/mine-inapp-notification-routing.module.ts diff --git a/dmp-frontend/src/app/ui/inapp-notification/mine-inapp-notification.module.ts b/dmp-frontend/src/notification-service/ui/inapp-notification/mine-inapp-notification.module.ts similarity index 91% rename from dmp-frontend/src/app/ui/inapp-notification/mine-inapp-notification.module.ts rename to dmp-frontend/src/notification-service/ui/inapp-notification/mine-inapp-notification.module.ts index 8dc20bc03..352fa5076 100644 --- a/dmp-frontend/src/app/ui/inapp-notification/mine-inapp-notification.module.ts +++ b/dmp-frontend/src/notification-service/ui/inapp-notification/mine-inapp-notification.module.ts @@ -12,6 +12,7 @@ import { MineInAppNotificationListingFiltersComponent } from './listing/filters/ import { MineInAppNotificationListingDialogComponent } from './listing-dialog/mine-inapp-notification-listing-dialog.component'; import { CommonFormattingModule } from '@common/formatting/common-formatting.module'; import { FormattingModule } from '@app/core/formatting.module'; +import { NotificationServiceFormattingModule } from '@notification-service/core/formatting/formatting.module'; @NgModule({ imports: [ @@ -23,7 +24,8 @@ import { FormattingModule } from '@app/core/formatting.module'; MineInAppNotificationRoutingModule, UserSettingsModule, CommonFormattingModule, - FormattingModule + // FormattingModule, + NotificationServiceFormattingModule ], declarations: [ MineInAppNotificationListingComponent, diff --git a/dmp-frontend/src/notification-service/ui/user-profile/notifier-list/user-profile-notifier-list-editor.component.ts b/dmp-frontend/src/notification-service/ui/user-profile/notifier-list/user-profile-notifier-list-editor.component.ts index 2cd130b19..2e58b8907 100644 --- a/dmp-frontend/src/notification-service/ui/user-profile/notifier-list/user-profile-notifier-list-editor.component.ts +++ b/dmp-frontend/src/notification-service/ui/user-profile/notifier-list/user-profile-notifier-list-editor.component.ts @@ -8,17 +8,15 @@ import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/serv import { BaseComponent } from '@common/base/base.component'; import { FormService } from '@common/forms/form-service'; import { HttpError, HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service'; -// import { TotpService } from '@idp-service/ui/totp/totp.service'; import { TranslateService } from '@ngx-translate/core'; -import { ContactType } from '@notification-service/core/enum/contact-type.enum'; +import { NotificationContactType } from '@notification-service/core/enum/notification-contact-type'; import { NotificationTrackingProcess } from '@notification-service/core/enum/notification-tracking-process.enum'; import { NotificationType } from '@notification-service/core/enum/notification-type.enum'; import { NotificationServiceEnumUtils } from '@notification-service/core/formatting/enum-utils.service'; import { UserNotificationPreference } from '@notification-service/core/model/user-notification-preference.model'; import { NotifierListLookup } from '@notification-service/core/query/notifier-list.lookup'; import { UserNotificationPreferenceService } from '@notification-service/services/http/user-notification-preference.service'; -import { UserProfileNotifierListEditorModel } from '@notification-service/ui/user-profile/notifier-list/user-profile-notifier-list-editor.model'; -import { delay, takeUntil } from 'rxjs/operators'; +import { takeUntil } from 'rxjs/operators'; import { nameof } from 'ts-simple-nameof'; @Component({ @@ -28,12 +26,10 @@ import { nameof } from 'ts-simple-nameof'; }) export class UserProfileNotifierListEditorComponent extends BaseComponent implements OnInit { - formGroup: FormGroup; - editorModel: UserProfileNotifierListEditorModel; - availableNotifiers: { [key: string]: ContactType[] } = {}; + availableNotifiers: { [key: string]: NotificationContactType[] } = {}; availableNotifiersKeys: NotificationType[]; - notificationTrackingProcess: NotificationTrackingProcess = NotificationTrackingProcess.Pending; + notificationTrackingProcess: NotificationTrackingProcess = NotificationTrackingProcess.PENDING; constructor( private userNotificationPreferenceService: UserNotificationPreferenceService, @@ -54,7 +50,6 @@ export class UserProfileNotifierListEditorComponent extends BaseComponent implem } getConfiguration() { - this.formGroup = null; this.userNotificationPreferenceService.getNotifierList(new NotifierListLookup()) .pipe(takeUntil(this._destroyed)) .subscribe( @@ -64,7 +59,7 @@ export class UserProfileNotifierListEditorComponent extends BaseComponent implem this.availableNotifiersKeys = Object.keys(this.availableNotifiers) as NotificationType[]; this.getExistingSelections(); } catch { - this.notificationTrackingProcess = NotificationTrackingProcess.Error; + this.notificationTrackingProcess = NotificationTrackingProcess.ERROR; this.logger.error('Could not parse Dataset: ' + data); this.uiNotificationService.snackBarNotification(this.language.instant('COMMONS.ERRORS.DEFAULT'), SnackBarNotificationLevel.Error); } @@ -86,9 +81,9 @@ export class UserProfileNotifierListEditorComponent extends BaseComponent implem if (data.length > 0) { this.orderAvailableItemsbasedOnExistingSelections(data); } - this.notificationTrackingProcess = NotificationTrackingProcess.Completed; + this.notificationTrackingProcess = NotificationTrackingProcess.SUCCESSFUL; } catch { - this.notificationTrackingProcess = NotificationTrackingProcess.Error; + this.notificationTrackingProcess = NotificationTrackingProcess.ERROR; this.logger.error('Could not parse Dataset: ' + data); this.uiNotificationService.snackBarNotification(this.language.instant('COMMONS.ERRORS.DEFAULT'), SnackBarNotificationLevel.Error); } @@ -128,7 +123,7 @@ export class UserProfileNotifierListEditorComponent extends BaseComponent implem } onCallbackError(errorResponse: HttpErrorResponse) { - this.notificationTrackingProcess = NotificationTrackingProcess.Error; + this.notificationTrackingProcess = NotificationTrackingProcess.ERROR; const error: HttpError = this.httpErrorHandlingService.getError(errorResponse); if (error.statusCode === 400) { @@ -137,22 +132,17 @@ export class UserProfileNotifierListEditorComponent extends BaseComponent implem } } - clearErrorModel() { - this.editorModel.validationErrorModel.clear(); - this.formService.validateAllFormFields(this.formGroup); - } - dropped(event: CdkDragDrop, type: NotificationType) { moveItemInArray(this.availableNotifiers[type], event.previousIndex, event.currentIndex); } preferencesNotPending(): boolean { - return ! (this.notificationTrackingProcess === NotificationTrackingProcess.Pending); + return ! (this.notificationTrackingProcess === NotificationTrackingProcess.PENDING); } preferencesNotCompleted(): boolean { - return ! (this.notificationTrackingProcess === NotificationTrackingProcess.Completed); + return ! (this.notificationTrackingProcess === NotificationTrackingProcess.SUCCESSFUL); } preferencesNotWithErrors(): boolean { - return ! (this.notificationTrackingProcess === NotificationTrackingProcess.Error); + return ! (this.notificationTrackingProcess === NotificationTrackingProcess.ERROR); } } diff --git a/dmp-frontend/src/notification-service/ui/user-profile/notifier-list/user-profile-notifier-list-editor.model.ts b/dmp-frontend/src/notification-service/ui/user-profile/notifier-list/user-profile-notifier-list-editor.model.ts deleted file mode 100644 index 5e4a717d9..000000000 --- a/dmp-frontend/src/notification-service/ui/user-profile/notifier-list/user-profile-notifier-list-editor.model.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { FormBuilder, FormControl, FormGroup } from '@angular/forms'; -import { BackendErrorValidator } from '@common/forms/validation/custom-validator'; -import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model'; -import { Validation, ValidationContext } from '@common/forms/validation/validation-context'; -import { Guid } from '@common/types/guid'; -import { ContactType } from '@notification-service/core/enum/contact-type.enum'; -import { NotificationType } from '@notification-service/core/enum/notification-type.enum'; -import { UserNotificationPreferencePersist } from '@notification-service/core/model/user-notification-preference.model'; - -export class UserProfileNotifierListEditorModel implements UserNotificationPreferencePersist { - userId?: Guid; - notificationPreferences: { [key: string]: ContactType[] }; - - public validationErrorModel: ValidationErrorModel = new ValidationErrorModel(); - protected formBuilder: FormBuilder = new FormBuilder(); - - constructor() { } - - public fromModel(userId: Guid, notificationPreferences: { [key: string]: ContactType[] }): UserProfileNotifierListEditorModel { - this.userId = userId; - this.notificationPreferences = notificationPreferences; - return this; - } - - buildForm(context: ValidationContext = null, disabled: boolean = false, availableNotificationTypes: NotificationType[]): FormGroup { - if (context == null) { context = this.createValidationContext(); } - - const notificationPreferencesFormGroup = this.formBuilder.group({}); - availableNotificationTypes.forEach(type => { - notificationPreferencesFormGroup.addControl(type, new FormControl(this.notificationPreferences ? this.notificationPreferences[type] : undefined)); - }); - - return this.formBuilder.group({ - userId: [{ value: this.userId, disabled: disabled }, context.getValidation('userId').validators], - notificationPreferences: notificationPreferencesFormGroup, - }); - } - - createValidationContext(): ValidationContext { - const baseContext: ValidationContext = new ValidationContext(); - const baseValidationArray: Validation[] = new Array(); - - baseValidationArray.push({ key: 'userId', validators: [BackendErrorValidator(this.validationErrorModel, 'UserId')] }); - - baseContext.validation = baseValidationArray; - return baseContext; - } -} diff --git a/dmp-frontend/src/notification-service/ui/user-profile/notifier-list/user-profile-notifier-list-editor.module.ts b/dmp-frontend/src/notification-service/ui/user-profile/notifier-list/user-profile-notifier-list-editor.module.ts index 8279617c7..6c09110b9 100644 --- a/dmp-frontend/src/notification-service/ui/user-profile/notifier-list/user-profile-notifier-list-editor.module.ts +++ b/dmp-frontend/src/notification-service/ui/user-profile/notifier-list/user-profile-notifier-list-editor.module.ts @@ -11,8 +11,6 @@ import { UserProfileNotifierListEditorComponent } from '@notification-service/ui CommonUiModule, CommonFormsModule, DragDropModule, - CoreNotificationServiceModule.forRoot(), - // TotpModule, ], declarations: [ UserProfileNotifierListEditorComponent