view models

This commit is contained in:
2025-12-18 01:20:23 +01:00
parent 7c449af311
commit cc2553876a
216 changed files with 485 additions and 10179 deletions

View File

@@ -0,0 +1,32 @@
/**
* Record engagement input view model
* Represents input data for recording an engagement event
*
* Note: No matching generated DTO available yet
*/
export class RecordEngagementInputViewModel {
eventType: string;
userId?: string;
metadata?: Record<string, unknown>;
constructor(data: { eventType: string; userId?: string; metadata?: Record<string, unknown> }) {
this.eventType = data.eventType;
this.userId = data.userId;
this.metadata = data.metadata;
}
/** UI-specific: Formatted event type for display */
get displayEventType(): string {
return this.eventType.replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase());
}
/** UI-specific: Has metadata */
get hasMetadata(): boolean {
return this.metadata !== undefined && Object.keys(this.metadata).length > 0;
}
/** UI-specific: Metadata keys count */
get metadataKeysCount(): number {
return this.metadata ? Object.keys(this.metadata).length : 0;
}
}