resolve manual DTOs
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user