view models
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import { RecordEngagementOutputDTO } from '../types/generated';
|
||||
|
||||
/**
|
||||
* Record engagement output view model
|
||||
* Represents the result of recording an engagement event for UI consumption
|
||||
*/
|
||||
export class RecordEngagementOutputViewModel {
|
||||
eventId: string;
|
||||
engagementWeight: number;
|
||||
|
||||
constructor(dto: RecordEngagementOutputDTO) {
|
||||
this.eventId = dto.eventId;
|
||||
this.engagementWeight = dto.engagementWeight;
|
||||
}
|
||||
|
||||
/** UI-specific: Formatted event ID for display */
|
||||
get displayEventId(): string {
|
||||
return `Event: ${this.eventId}`;
|
||||
}
|
||||
|
||||
/** UI-specific: Formatted engagement weight */
|
||||
get displayEngagementWeight(): string {
|
||||
return `${this.engagementWeight.toFixed(2)}`;
|
||||
}
|
||||
|
||||
/** UI-specific: Is high engagement */
|
||||
get isHighEngagement(): boolean {
|
||||
return this.engagementWeight > 1.0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user