From c66439c859aaf33a0b3af7baa8f5cdab339461bb Mon Sep 17 00:00:00 2001 From: Dan Percic Date: Fri, 29 Oct 2021 14:43:40 +0300 Subject: [PATCH] move justification to red-domain --- .../add-edit-justification-dialog.component.ts | 2 +- .../justifications-dialog.service.ts | 2 +- .../justifications-screen.component.ts | 2 +- .../table-item/table-item.component.ts | 2 +- .../entity-services/justifications.service.ts | 3 +-- libs/red-domain/src/index.ts | 1 + libs/red-domain/src/lib/legal-basis/index.ts | 3 +++ .../src/lib/legal-basis}/justification.model.ts | 15 +++++++++------ .../legal-basis-change.request.ts | 0 .../{redaction-log => legal-basis}/legal-basis.ts | 2 +- libs/red-domain/src/lib/redaction-log/index.ts | 2 -- .../src/lib/redaction-log/redaction-log.ts | 2 +- 12 files changed, 20 insertions(+), 16 deletions(-) create mode 100644 libs/red-domain/src/lib/legal-basis/index.ts rename {apps/red-ui/src/app/models => libs/red-domain/src/lib/legal-basis}/justification.model.ts (64%) rename libs/red-domain/src/lib/{redaction-log => legal-basis}/legal-basis-change.request.ts (100%) rename libs/red-domain/src/lib/{redaction-log => legal-basis}/legal-basis.ts (80%) diff --git a/apps/red-ui/src/app/modules/admin/screens/justifications/add-edit-justification-dialog/add-edit-justification-dialog.component.ts b/apps/red-ui/src/app/modules/admin/screens/justifications/add-edit-justification-dialog/add-edit-justification-dialog.component.ts index 99416e913..fd612f3c6 100644 --- a/apps/red-ui/src/app/modules/admin/screens/justifications/add-edit-justification-dialog/add-edit-justification-dialog.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/justifications/add-edit-justification-dialog/add-edit-justification-dialog.component.ts @@ -1,7 +1,7 @@ import { ChangeDetectionStrategy, Component, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; -import { Justification } from '@models/justification.model'; +import { Justification } from '@red/domain'; import { JustificationsService } from '@services/entity-services/justifications.service'; import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service'; import { LoadingService } from '@iqser/common-ui'; diff --git a/apps/red-ui/src/app/modules/admin/screens/justifications/justifications-dialog.service.ts b/apps/red-ui/src/app/modules/admin/screens/justifications/justifications-dialog.service.ts index da20898d8..523bbee1d 100644 --- a/apps/red-ui/src/app/modules/admin/screens/justifications/justifications-dialog.service.ts +++ b/apps/red-ui/src/app/modules/admin/screens/justifications/justifications-dialog.service.ts @@ -13,7 +13,7 @@ import { AddEditJustificationDialogComponent } from './add-edit-justification-di import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service'; import { JustificationsService } from '@services/entity-services/justifications.service'; -import { Justification } from '@models/justification.model'; +import { Justification } from '@red/domain'; type DialogType = 'confirm' | 'addEditJustification'; diff --git a/apps/red-ui/src/app/modules/admin/screens/justifications/justifications-screen/justifications-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/justifications/justifications-screen/justifications-screen.component.ts index 8c274b165..d7aa71663 100644 --- a/apps/red-ui/src/app/modules/admin/screens/justifications/justifications-screen/justifications-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/justifications/justifications-screen/justifications-screen.component.ts @@ -9,7 +9,7 @@ import { LoadingService, TableColumnConfig, } from '@iqser/common-ui'; -import { Justification } from '@models/justification.model'; +import { Justification } from '@red/domain'; import { JustificationsService } from '@services/entity-services/justifications.service'; import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service'; import { JustificationsDialogService } from '../justifications-dialog.service'; diff --git a/apps/red-ui/src/app/modules/admin/screens/justifications/table-item/table-item.component.ts b/apps/red-ui/src/app/modules/admin/screens/justifications/table-item/table-item.component.ts index 483026d1a..3082d73d9 100644 --- a/apps/red-ui/src/app/modules/admin/screens/justifications/table-item/table-item.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/justifications/table-item/table-item.component.ts @@ -1,5 +1,5 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; -import { Justification } from '@models/justification.model'; +import { Justification } from '@red/domain'; import { CircleButtonTypes, ListingService, LoadingService } from '@iqser/common-ui'; import { JustificationsDialogService } from '../justifications-dialog.service'; import { UserService } from '@services/user.service'; diff --git a/apps/red-ui/src/app/services/entity-services/justifications.service.ts b/apps/red-ui/src/app/services/entity-services/justifications.service.ts index f42fc5ec8..d2ad24cd2 100644 --- a/apps/red-ui/src/app/services/entity-services/justifications.service.ts +++ b/apps/red-ui/src/app/services/entity-services/justifications.service.ts @@ -1,9 +1,8 @@ import { Injectable, Injector } from '@angular/core'; import { EntitiesService, RequiredParam, Validate } from '@iqser/common-ui'; -import { Justification } from '@models/justification.model'; +import { ILegalBasis, Justification } from '@red/domain'; import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; -import { ILegalBasis } from '@red/domain'; @Injectable({ providedIn: 'root', diff --git a/libs/red-domain/src/index.ts b/libs/red-domain/src/index.ts index c22d118f6..5365dabd6 100644 --- a/libs/red-domain/src/index.ts +++ b/libs/red-domain/src/index.ts @@ -16,3 +16,4 @@ export * from './lib/downloads'; export * from './lib/reports'; export * from './lib/configuration'; export * from './lib/signature'; +export * from './lib/legal-basis'; diff --git a/libs/red-domain/src/lib/legal-basis/index.ts b/libs/red-domain/src/lib/legal-basis/index.ts new file mode 100644 index 000000000..93da6669b --- /dev/null +++ b/libs/red-domain/src/lib/legal-basis/index.ts @@ -0,0 +1,3 @@ +export * from './legal-basis-change.request'; +export * from './legal-basis'; +export * from './justification.model'; diff --git a/apps/red-ui/src/app/models/justification.model.ts b/libs/red-domain/src/lib/legal-basis/justification.model.ts similarity index 64% rename from apps/red-ui/src/app/models/justification.model.ts rename to libs/red-domain/src/lib/legal-basis/justification.model.ts index 65fd6b921..50fcfa71c 100644 --- a/apps/red-ui/src/app/models/justification.model.ts +++ b/libs/red-domain/src/lib/legal-basis/justification.model.ts @@ -1,19 +1,22 @@ import { IListable } from '@iqser/common-ui'; -import { ILegalBasis } from '@red/domain'; +import { ILegalBasis } from './legal-basis'; export class Justification implements ILegalBasis, IListable { - readonly id: string; readonly description?: string; - readonly name?: string; + readonly name: string; readonly reason?: string; - readonly searchKey: string; constructor(justification: ILegalBasis) { - this.id = justification.name; this.description = justification.description; this.name = justification.name; this.reason = justification.reason; + } - this.searchKey = this.name; + get id(): string { + return this.name; + } + + get searchKey(): string { + return this.name; } } diff --git a/libs/red-domain/src/lib/redaction-log/legal-basis-change.request.ts b/libs/red-domain/src/lib/legal-basis/legal-basis-change.request.ts similarity index 100% rename from libs/red-domain/src/lib/redaction-log/legal-basis-change.request.ts rename to libs/red-domain/src/lib/legal-basis/legal-basis-change.request.ts diff --git a/libs/red-domain/src/lib/redaction-log/legal-basis.ts b/libs/red-domain/src/lib/legal-basis/legal-basis.ts similarity index 80% rename from libs/red-domain/src/lib/redaction-log/legal-basis.ts rename to libs/red-domain/src/lib/legal-basis/legal-basis.ts index 56e7fc25c..3ec087e3a 100644 --- a/libs/red-domain/src/lib/redaction-log/legal-basis.ts +++ b/libs/red-domain/src/lib/legal-basis/legal-basis.ts @@ -1,5 +1,5 @@ export interface ILegalBasis { + name: string; description?: string; - name?: string; reason?: string; } diff --git a/libs/red-domain/src/lib/redaction-log/index.ts b/libs/red-domain/src/lib/redaction-log/index.ts index ac8b3d300..eef5f3805 100644 --- a/libs/red-domain/src/lib/redaction-log/index.ts +++ b/libs/red-domain/src/lib/redaction-log/index.ts @@ -1,12 +1,10 @@ export * from './types'; export * from './change'; export * from './comment'; -export * from './legal-basis'; export * from './add-redaction.request'; export * from './manual-redaction-entry'; export * from './redaction-log-entry'; export * from './redaction-log'; -export * from './legal-basis-change.request'; export * from './remove-redaction.request'; export * from './manual-add.response'; export * from './approve-request'; diff --git a/libs/red-domain/src/lib/redaction-log/redaction-log.ts b/libs/red-domain/src/lib/redaction-log/redaction-log.ts index 64f29586d..b5de4258e 100644 --- a/libs/red-domain/src/lib/redaction-log/redaction-log.ts +++ b/libs/red-domain/src/lib/redaction-log/redaction-log.ts @@ -1,4 +1,4 @@ -import { ILegalBasis } from './legal-basis'; +import { ILegalBasis } from '../legal-basis'; import { IRedactionLogEntry } from './redaction-log-entry'; export interface IRedactionLog {