add notificationTemplateBodyText interface

This commit is contained in:
mchouliara 2024-10-02 12:29:17 +03:00
parent 3a93d006e1
commit 7bda265eb1
4 changed files with 12 additions and 9 deletions

View File

@ -5,6 +5,7 @@ import { NotificationTemplateKind } from '@notification-service/core/enum/notifi
import { NotificationType } from '@notification-service/core/enum/notification-type.enum';
import { EmailOverrideMode } from '../enum/email-override-mode';
import { NotificationDataType } from '../enum/notification-data-type';
import { JSONTemplate } from 'angular-email-editor/types';
export interface NotificationTemplate {
id?: Guid;
@ -36,6 +37,11 @@ export interface NotificationTemplateValue {
bodyFieldOptions: NotificationFieldOptions;
}
export interface NotificationTemplateBodyText {
design: JSONTemplate;
html: string;
}
export interface NotificationFieldOptions {
mandatory?: string[];
optional?: NotificationFieldInfo[];

View File

@ -29,7 +29,7 @@ import { NotificationTemplateChannel } from '@notification-service/core/enum/not
import { NotificationTemplateKind } from '@notification-service/core/enum/notification-template-kind.enum';
import { NotificationType } from '@notification-service/core/enum/notification-type.enum';
import { NotificationServiceEnumUtils } from '@notification-service/core/formatting/enum-utils.service';
import { NotificationTemplate, NotificationTemplatePersist } from '@notification-service/core/model/notification-template.model';
import { NotificationTemplateBodyText, NotificationTemplate, NotificationTemplatePersist } from '@notification-service/core/model/notification-template.model';
import { NotificationTemplateService } from '@notification-service/services/http/notification-template.service';
import { map, takeUntil } from 'rxjs/operators';
import { NotificationTemplateEditorModel } from './notification-template-editor.model';
@ -200,7 +200,7 @@ export class NotificationTemplateEditorComponent extends BaseEditor<Notification
attemptSave(): void {
if(this.emailEditor?.editor){
this.emailEditor?.editor?.exportHtml((data) => {
const json: BodyTemplateJSON = {
const json: NotificationTemplateBodyText = {
design: data?.design,
html: data?.html
};
@ -338,9 +338,4 @@ export class NotificationTemplateEditorComponent extends BaseEditor<Notification
this.editorReady = true;
}
}
export interface BodyTemplateJSON {
design: JSONTemplate;
html: string;
}

View File

@ -1,5 +1,5 @@
import { FormArray, FormControl, UntypedFormArray, UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';
import { NotificationFieldInfo, NotificationFieldInfoPersist, NotificationFieldOptions, NotificationFieldOptionsPersist, NotificationTemplate, NotificationTemplatePersist, NotificationTemplateValue, NotificationTemplateValuePersist } from '@notification-service/core/model/notification-template.model';
import { NotificationFieldInfo, NotificationFieldInfoPersist, NotificationFieldOptions, NotificationFieldOptionsPersist, NotificationTemplate, NotificationTemplateBodyText, NotificationTemplatePersist, NotificationTemplateValue, NotificationTemplateValuePersist } from '@notification-service/core/model/notification-template.model';
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';

View File

@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
import { Language } from '@app/core/model/language/language';
import { NotificationFieldInfo, NotificationFieldOptions, NotificationTemplate, NotificationTemplateValue } from '@notification-service/core/model/notification-template.model';
import { NotificationFieldInfo, NotificationFieldOptions, NotificationTemplate, NotificationTemplateBodyText, NotificationTemplateValue } from '@notification-service/core/model/notification-template.model';
import { NotificationTemplateService } from '@notification-service/services/http/notification-template.service';
import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service';
import { BaseEditorResolver } from '@common/base/base-editor.resolver';
@ -35,6 +35,8 @@ export class NotificationTemplateEditorResolver extends BaseEditorResolver {
[nameof<NotificationTemplate>(x => x.value),nameof<NotificationTemplateValue>(x => x.subjectFieldOptions), nameof<NotificationFieldOptions>(x => x.optional), nameof<NotificationFieldInfo>(x => x.value)].join('.'),
[nameof<NotificationTemplate>(x => x.value),nameof<NotificationTemplateValue>(x => x.subjectFieldOptions), nameof<NotificationFieldOptions>(x => x.formatting)].join('.'),
[nameof<NotificationTemplate>(x => x.value),nameof<NotificationTemplateValue>(x => x.bodyText)].join('.'),
// [nameof<NotificationTemplate>(x => x.value),nameof<NotificationTemplateValue>(x => x.bodyText), nameof<NotificationTemplateBodyText>(x => x.design)].join('.'),
// [nameof<NotificationTemplate>(x => x.value),nameof<NotificationTemplateValue>(x => x.bodyText), nameof<NotificationTemplateBodyText>(x => x.html)].join('.'),
[nameof<NotificationTemplate>(x => x.value),nameof<NotificationTemplateValue>(x => x.bodyKey)].join('.'),
[nameof<NotificationTemplate>(x => x.value),nameof<NotificationTemplateValue>(x => x.bodyFieldOptions), nameof<NotificationFieldOptions>(x => x.mandatory)].join('.'),
[nameof<NotificationTemplate>(x => x.value),nameof<NotificationTemplateValue>(x => x.bodyFieldOptions), nameof<NotificationFieldOptions>(x => x.optional)].join('.'),