view models
This commit is contained in:
@@ -1,9 +1,32 @@
|
||||
// Note: No generated DTO available for DeleteMedia yet
|
||||
interface DeleteMediaDTO {
|
||||
success: boolean;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete Media View Model
|
||||
*
|
||||
* Represents the result of a media deletion operation
|
||||
*/
|
||||
export interface DeleteMediaViewModel {
|
||||
export class DeleteMediaViewModel {
|
||||
success: boolean;
|
||||
error?: string;
|
||||
|
||||
constructor(dto: DeleteMediaDTO) {
|
||||
this.success = dto.success;
|
||||
if (dto.error !== undefined) {
|
||||
this.error = dto.error;
|
||||
}
|
||||
}
|
||||
|
||||
/** UI-specific: Whether the deletion 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