feat: Extension getter zur Doc-Klasse hinzufügen, um die Dateierweiterung aus der Eigenschaft name abzurufen

This commit is contained in:
tekh 2025-07-11 11:22:31 +02:00
parent 24c3bf0324
commit b9e6ff27db
3 changed files with 9 additions and 4 deletions

View File

@ -301,4 +301,4 @@ export const _documents: Doc[] = [
addedWhen: new Date("2024-04-17T11:25:00Z"),
addedWho: "SchreiberM"
}
];
].map(doc => Object.assign(doc));

View File

@ -8,6 +8,14 @@ export class Doc {
addedWho!: string;
changedWhen?: Date;
changedWho?: string;
get Extension(): string | undefined {
const parts = this.name.split('.');
if (parts.length > 1 && parts[parts.length - 1].trim() !== '') {
return parts[parts.length - 1].toLowerCase();
}
return undefined;
}
}
export type DocQuery = {

View File

@ -6,11 +6,8 @@ import { varAlpha } from 'minimal-shared/utils';
import Box from '@mui/material/Box';
import Link from '@mui/material/Link';
import Card from '@mui/material/Card';
import Avatar from '@mui/material/Avatar';
import Typography from '@mui/material/Typography';
import { fDate } from 'src/utils/format-time';
import { Doc } from 'src/api/document-service';
import { Iconify } from 'src/components/iconify';