Service Layer medium complexity backend
1
Dependencies
2
Dependents
5
Entities
0
Integrations

Description

Backend service that queries activities, events, and audit_logs tables with cursor-based pagination sorted by created_at descending. Enforces tenant isolation via organization_id filter on every query and returns a unified polymorphic entry DTO consumed by the feed widget.

Feature: Activity Feed

activity-feed-service

Sources & reasoning

The blueprint explicitly names this service and the implementation notes provide detailed query strategy. Cursor-based pagination and tenant isolation are core responsibilities that warrant a dedicated service rather than ad-hoc queries in the controller.

  • docs/source/likeperson.md · line 184
    Activity oversight, approval workflows, and corrections
  • docs/source/likeperson.md · line 317
    Aktivitetsoversikt og grunnleggende statistikk
  • docs/source/likeperson.md · line 476
    admin-dashboard | Admin Dashboard | Dashboard KPIs, Activity Feed

Responsibilities

  • Execute cursor-based paginated queries across activities, events, and audit_logs tables
  • Enforce organization_id tenant isolation on every query
  • Map heterogeneous DB rows to a unified FeedEntry DTO with type discriminator
  • Support filtering by entry type (activity, expense, system_event)
  • Expose an SSE endpoint or polling endpoint for live feed updates

Interfaces

getFeedPage(orgId, cursor?, pageSize?, filters?): Promise<FeedPage>
getFeedStream(orgId): EventSource
FeedPage: { entries: FeedEntry[], nextCursor: string|null }

Relationships

Dependencies (1)

Components this component depends on

Dependents (2)

Components that depend on this component