Activity Feed Repository
Component Detail
Data Layer
high complexity
backend
0
Dependencies
1
Dependents
0
Entities
0
Integrations
Description
Executes multi-table aggregation queries against PostgreSQL joining activities, expenses, event_registrations, and audit_logs ordered by created_at descending. Handles keyset cursor pagination on (created_at, id) and maps raw rows to normalized RawEvent objects for the service layer.
activity-feed-repository
Responsibilities
- Execute multi-table UNION queries aggregating feed events from source tables
- Implement keyset cursor pagination on (created_at, id) for efficient traversal
- Apply organization-scoped WHERE clauses for tenant isolation
- Map raw database rows to typed RawEvent objects
Interfaces
queryFeedEvents(orgId: string, filters: FeedFilters, cursor?: CursorPosition, limit?: number): Promise<RawEvent[]>
countFeedEvents(orgId: string, filters: FeedFilters): Promise<number>
resolveCursorFromEvent(eventId: string, eventType: string): Promise<CursorPosition>