refactor: front end

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-03-28 12:47:21 -04:00
parent 28e5cce23a
commit ccb781f933
38 changed files with 4909 additions and 2897 deletions

79
src/models/document.ts Normal file
View File

@@ -0,0 +1,79 @@
import type { DocumentInterface, DocumentModelInterface } from "@/types/document";
export class DocumentObject implements DocumentModelInterface {
_data!: DocumentInterface;
constructor() {
this._data = {
'@type': 'documents:document',
urid: null,
size: 0,
label: '',
mime: null,
format: null,
encoding: null,
};
}
fromJson(data: DocumentInterface): DocumentObject {
this._data = data;
return this;
}
toJson(): DocumentInterface {
return this._data;
}
clone(): DocumentObject {
const cloned = new DocumentObject();
cloned._data = { ...this._data };
return cloned;
}
/** Immutable Properties */
get urid(): string | null {
return this._data.urid;
}
get size(): number {
const parsed = typeof this._data.size === 'number' ? this._data.size : Number(this._data.size);
return Number.isFinite(parsed) && parsed >= 0 ? parsed : 0;
}
/** Mutable Properties */
get label(): string | null {
return this._data.label || null;
}
set label(value: string) {
this._data.label = value;
}
get mime(): string | null {
return this._data.mime;
}
set mime(value: string) {
this._data.mime = value;
}
get format(): string | null {
return this._data.format;
}
set format(value: string) {
this._data.format = value;
}
get encoding(): string | null {
return this._data.encoding;
}
set encoding(value: string) {
this._data.encoding = value;
}
}