feat(doc): Unterstützung für benutzerdefinierte Dokumentattribute hinzufügen

This commit is contained in:
tekh 2025-07-14 13:56:36 +02:00
parent 8d7615fb37
commit d5d82a5a1e

View File

@ -22,6 +22,11 @@ const validExtensions: FileFormat[] = [
'png', 'svg', 'zip', 'md' 'png', 'svg', 'zip', 'md'
]; ];
type DocAttribute = {
name: string;
serilizedValue: string;
}
export class Doc { export class Doc {
static map(source?: Partial<Doc>): Doc { static map(source?: Partial<Doc>): Doc {
@ -37,6 +42,7 @@ export class Doc {
addedWho!: string; addedWho!: string;
changedWhen?: Date; changedWhen?: Date;
changedWho?: string; changedWho?: string;
attributes: Array<DocAttribute> = [];
getChangedInfo(separator: string = " | "): string | null { getChangedInfo(separator: string = " | "): string | null {
const who = this.changedWho?.trim(); const who = this.changedWho?.trim();
@ -53,7 +59,7 @@ export class Doc {
const parts = this.name.split('.'); const parts = this.name.split('.');
if (parts.length > 1 && parts[parts.length - 1].trim() !== '') { if (parts.length > 1 && parts[parts.length - 1].trim() !== '') {
const ext = parts[parts.length - 1].toLowerCase(); const ext = parts[parts.length - 1].toLowerCase();
if (validExtensions.includes(ext as FileFormat)) if (validExtensions.includes(ext as FileFormat))
return ext as FileFormat; return ext as FileFormat;
} }