resolve manual DTOs

This commit is contained in:
2025-12-18 22:19:40 +01:00
parent 4a3087ae35
commit d617654928
179 changed files with 3716 additions and 1257 deletions

View File

@@ -1,12 +1,4 @@
// Note: No generated DTO available for Media yet
interface MediaDTO {
id: string;
url: string;
type: 'image' | 'video' | 'document';
category?: 'avatar' | 'team-logo' | 'league-cover' | 'race-result';
uploadedAt: Date;
size?: number;
}
import type { GetMediaOutputDTO } from '../types/generated';
/**
* Media View Model
@@ -21,12 +13,12 @@ export class MediaViewModel {
uploadedAt: Date;
size?: number;
constructor(dto: MediaDTO) {
constructor(dto: GetMediaOutputDTO) {
this.id = dto.id;
this.url = dto.url;
this.type = dto.type;
this.uploadedAt = dto.uploadedAt;
if (dto.category !== undefined) this.category = dto.category;
this.type = dto.type as 'image' | 'video' | 'document';
this.uploadedAt = new Date(dto.uploadedAt);
if (dto.category !== undefined) this.category = dto.category as 'avatar' | 'team-logo' | 'league-cover' | 'race-result';
if (dto.size !== undefined) this.size = dto.size;
}