fix issues

This commit is contained in:
2025-12-26 11:49:20 +01:00
parent d08ec10b40
commit 68ae9da22a
44 changed files with 505 additions and 179 deletions

View File

@@ -11,11 +11,33 @@ export class RequestAvatarGenerationViewModel {
avatarUrls?: string[];
errorMessage?: string;
constructor(dto: RequestAvatarGenerationOutputDTO) {
constructor(
dto:
| RequestAvatarGenerationOutputDTO
| {
success: boolean;
requestId?: string;
avatarUrls?: string[];
errorMessage?: string;
avatarUrl?: string;
error?: string;
},
) {
this.success = dto.success;
if (dto.requestId !== undefined) this.requestId = dto.requestId;
if (dto.avatarUrls !== undefined) this.avatarUrls = dto.avatarUrls;
if (dto.errorMessage !== undefined) this.errorMessage = dto.errorMessage;
if ('requestId' in dto && dto.requestId !== undefined) this.requestId = dto.requestId;
if ('avatarUrls' in dto && dto.avatarUrls !== undefined) {
this.avatarUrls = dto.avatarUrls;
} else if ('avatarUrl' in dto && dto.avatarUrl !== undefined) {
this.avatarUrls = [dto.avatarUrl];
}
if ('errorMessage' in dto && dto.errorMessage !== undefined) {
this.errorMessage = dto.errorMessage;
} else if ('error' in dto && dto.error !== undefined) {
this.errorMessage = dto.error;
}
}
/** UI-specific: Whether generation was successful */