view models
This commit is contained in:
@@ -1,10 +1,33 @@
|
||||
// Note: No generated DTO available for RequestAvatarGeneration yet
|
||||
interface RequestAvatarGenerationDTO {
|
||||
success: boolean;
|
||||
avatarUrl?: string;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Request Avatar Generation View Model
|
||||
*
|
||||
* Represents the result of an avatar generation request
|
||||
*/
|
||||
export interface RequestAvatarGenerationViewModel {
|
||||
export class RequestAvatarGenerationViewModel {
|
||||
success: boolean;
|
||||
avatarUrl?: string;
|
||||
error?: string;
|
||||
|
||||
constructor(dto: RequestAvatarGenerationDTO) {
|
||||
this.success = dto.success;
|
||||
if (dto.avatarUrl !== undefined) this.avatarUrl = dto.avatarUrl;
|
||||
if (dto.error !== undefined) this.error = dto.error;
|
||||
}
|
||||
|
||||
/** UI-specific: Whether generation was successful */
|
||||
get isSuccessful(): boolean {
|
||||
return this.success;
|
||||
}
|
||||
|
||||
/** UI-specific: Whether there was an error */
|
||||
get hasError(): boolean {
|
||||
return !!this.error;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user