fix issues
This commit is contained in:
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user