legal basis change model classes

This commit is contained in:
Timo 2021-06-29 10:04:02 +03:00
parent 88314fba2e
commit 629597b751
8 changed files with 86 additions and 4 deletions

View File

@ -1,7 +1,7 @@
import { UserWrapper } from '@services/user.service';
import { AnnotationWrapper } from './annotation.wrapper';
export class AnnotationPermissions {
export class AnnotationPerimssions {
canUndo: boolean;
canAcceptRecommendation: boolean;

View File

@ -6,6 +6,7 @@ export class AnnotationWrapper {
| 'add-dictionary'
| 'remove-dictionary'
| 'remove-only-here'
| 'suggestion-change-legal-basis'
| 'suggestion-add-dictionary'
| 'suggestion-force-redaction'
| 'suggestion-remove-dictionary'
@ -55,6 +56,7 @@ export class AnnotationWrapper {
this.superType === 'suggestion-add-dictionary' ||
this.superType === 'suggestion-force-redaction' ||
this.superType === 'suggestion-remove-dictionary' ||
this.superType === 'suggestion-change-legal-basis' ||
this.superType === 'suggestion-add' ||
this.superType === 'suggestion-remove' ||
this.superType === 'skipped' ||
@ -155,7 +157,11 @@ export class AnnotationWrapper {
}
get isSuggestion() {
return this.isSuggestionAdd || this.isSuggestionRemove;
return this.isSuggestionAdd || this.isSuggestionRemove || this.isSuggestionChangeLegalBasis;
}
get isSuggestionChangeLegalBasis() {
return this.superType === 'suggestion-change-legal-basis';
}
get isSuggestionAdd() {
@ -245,6 +251,13 @@ export class AnnotationWrapper {
annotationWrapper: AnnotationWrapper,
redactionLogEntryWrapper: RedactionLogEntryWrapper
) {
if (
redactionLogEntryWrapper.legalBasisChangeValue &&
redactionLogEntryWrapper.status === 'REQUESTED'
) {
annotationWrapper.superType = 'suggestion-change-legal-basis';
}
if (redactionLogEntryWrapper.recommendation) {
if (redactionLogEntryWrapper.redacted) {
annotationWrapper.superType = 'recommendation';
@ -356,7 +369,9 @@ export class AnnotationWrapper {
if (entry.reason) {
content += entry.reason + '\n\n';
}
if (entry.legalBasis) {
if (entry.legalBasisChangeValue) {
content += 'Legal basis:' + entry.legalBasis + '\n\n';
} else if (entry.legalBasis) {
content += 'Legal basis:' + entry.legalBasis + '\n\n';
}
if (entry.section) {

View File

@ -225,6 +225,29 @@ export class FileDataModel {
}
});
this.manualRedactions.legalBasisChanges?.forEach(legalBasisChange => {
const relevantRedactionLogEntry = result.find(r => r.id === legalBasisChange.id);
if (!relevantRedactionLogEntry) {
// idRemove for something that doesn't exist - skip
return;
} else {
relevantRedactionLogEntry.legalBasisChangeValue = legalBasisChange.legalBasis;
// if statuses differ
if (relevantRedactionLogEntry.status !== legalBasisChange.status) {
relevantRedactionLogEntry.actionPendingReanalysis = true;
relevantRedactionLogEntry.status = legalBasisChange.status;
}
if (this._hasAlreadyBeenProcessed(legalBasisChange)) {
if (legalBasisChange.status === 'DECLINED') {
relevantRedactionLogEntry.status = null;
}
}
}
});
result.forEach(redactionLogEntry => {
if (redactionLogEntry.manual) {
if (redactionLogEntry.manualRedactionType === 'ADD') {

View File

@ -1,4 +1,4 @@
import { Comment, Rectangle } from '@redaction/red-ui-http';
import { Comment, Rectangle, RedactionLogEntry } from '@redaction/red-ui-http';
export interface RedactionLogEntryWrapper {
color?: Array<number>;
@ -34,4 +34,7 @@ export interface RedactionLogEntryWrapper {
isChangeLogEntry?: boolean;
changeLogType?: 'ADDED' | 'REMOVED';
recategorizationType?: string;
legalBasisChangeValue?: string;
}

View File

@ -559,6 +559,15 @@ export class AppStateService {
null,
true
);
// add suggestions
dictionaryData['suggestion-change-legal-basis'] = new TypeValueWrapper(
{
hexColor: colors.requestAdd,
type: 'suggestion-change-legal-basis'
},
null,
true
);
dictionaryData['suggestion-add-dictionary'] = new TypeValueWrapper(
{
hexColor: colors.dictionaryRequestColor,

View File

@ -0,0 +1,29 @@
/**
* API Documentation for Redaction Gateway
* Description for redaction
*
* OpenAPI spec version: 1.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
export interface ManualLegalBasisChange {
id?: string;
legalBasis?: string;
processedDate?: string;
requestDate?: string;
status?: ManualLegalBasisChange.StatusEnum;
user?: string;
}
export namespace ManualLegalBasisChange {
export type StatusEnum = 'APPROVED' | 'DECLINED' | 'REQUESTED';
export const StatusEnum = {
APPROVED: 'APPROVED' as StatusEnum,
DECLINED: 'DECLINED' as StatusEnum,
REQUESTED: 'REQUESTED' as StatusEnum
};
}

View File

@ -14,6 +14,7 @@ import { IdRemoval } from './idRemoval';
import { ManualForceRedaction } from './manualForceRedaction';
import { ManualImageRecategorization } from './manualImageRecategorization';
import { ManualRedactionEntry } from './manualRedactionEntry';
import { ManualLegalBasisChange } from './manualLegalBasisChange';
export interface ManualRedactions {
comments?: { [key: string]: Array<Comment> };
@ -21,4 +22,5 @@ export interface ManualRedactions {
forceRedactions?: Array<ManualForceRedaction>;
idsToRemove?: Array<IdRemoval>;
imageRecategorization?: Array<ManualImageRecategorization>;
legalBasisChanges?: Array<ManualLegalBasisChange>;
}

View File

@ -75,3 +75,4 @@ export * from './viewedPagesRequest';
export * from './watermarkModelReq';
export * from './watermarkModelRes';
export * from './legalBasisChangeRequest';
export * from './manualLegalBasisChange';