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

Description

Server-side service that listens for writes to key tables (activities, expense_claims, assignments, user_roles) and inserts normalized event rows into the feed_events table scoped by organization_id. Exposes a paginated REST endpoint (GET /api/v1/admin/feed) with cursor-based pagination and enforces tenant isolation and coordinator chapter scoping at the query level.

Feature: Activity Feed

feed-service

Responsibilities

  • Capture write events from activities, expense_claims, assignments, and user_roles tables and persist normalized feed rows
  • Enforce tenant isolation - every query is scoped to the requesting user's organization_id
  • Apply coordinator-level scoping so coordinators see only events from peer mentors within their local chapter
  • Serve paginated feed results (cursor-based, 20 per page, sorted by created_at desc) via GET /api/v1/admin/feed
  • Apply configurable feed retention policy (default 90 days) via environment variable to prune stale entries

Interfaces

getFeed(orgId: string, userId: string, cursor?: string, limit?: number): Promise<FeedPage>
recordFeedEvent(event: FeedEventInput): Promise<FeedEntry>
applyRetentionPolicy(orgId: string, retentionDays: number): Promise<number>
validateUserScope(userId: string, entry: FeedEntry): boolean

Relationships

Dependencies (2)

Components this component depends on

Dependents (1)

Components that depend on this component

Related Data Entities (3)

Data entities managed by this component