mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-20 08:33:11 +00:00
feat: add core
This commit is contained in:
71
src/core/things/Diff.ts
Normal file
71
src/core/things/Diff.ts
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCThingsWithoutDiff} from '../Classes';
|
||||
import {SCThing, SCThingMeta} from '../Thing';
|
||||
import {SCISO8601Date} from '../types/Time';
|
||||
|
||||
/**
|
||||
* Type of a diff
|
||||
*/
|
||||
export type SCDiffType = 'diff';
|
||||
|
||||
/**
|
||||
* A diff without references
|
||||
*/
|
||||
export interface SCDiffWithoutReferences extends SCThing {
|
||||
/**
|
||||
* Action of the diff
|
||||
*/
|
||||
action: 'changed' | 'removed';
|
||||
|
||||
/**
|
||||
* Diff patch. Only when action === 'changed'
|
||||
*/
|
||||
changes?: jsonpatch.OpPatch[];
|
||||
|
||||
/**
|
||||
* Creation date of the diff.
|
||||
*/
|
||||
dateCreated: SCISO8601Date;
|
||||
|
||||
/**
|
||||
* Type of a diff
|
||||
*/
|
||||
type: SCDiffType;
|
||||
}
|
||||
|
||||
/**
|
||||
* A diff
|
||||
*/
|
||||
export interface SCDiff extends SCDiffWithoutReferences {
|
||||
/**
|
||||
* Original object the diff was generated on
|
||||
*/
|
||||
object: SCThingsWithoutDiff;
|
||||
}
|
||||
|
||||
/**
|
||||
* Diff meta data
|
||||
*/
|
||||
export class SCDiffMeta extends SCThingMeta {
|
||||
static fieldTranslations = {
|
||||
...SCThingMeta.fieldTranslations,
|
||||
de: {
|
||||
action: 'Aktion',
|
||||
changes: 'Änderungen',
|
||||
dateCreated: 'Erstellungsdatum',
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user