Files
gridpilot.gg/apps/website/lib/view-models/DeleteMediaViewModel.ts
Marc Mintel d97f50ed72
Some checks failed
Contract Testing / contract-tests (pull_request) Failing after 6m4s
Contract Testing / contract-snapshot (pull_request) Has been skipped
view data fixes
2026-01-23 11:59:49 +01:00

31 lines
791 B
TypeScript

import type { DeleteMediaViewData } from '@/lib/builders/view-data/DeleteMediaViewData';
import { ViewModel } from '../contracts/view-models/ViewModel';
/**
* Delete Media View Model
*
* Represents the result of a media deletion operation
* Composes ViewData for UI consumption.
*/
export class DeleteMediaViewModel extends ViewModel {
success: boolean;
error?: string;
constructor(viewData: DeleteMediaViewData) {
super();
this.success = viewData.success;
if (viewData.error !== undefined) {
this.error = viewData.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;
}
}