Skip to content

Epic: Implement user_activity Table Support #12

@pmcfadin

Description

@pmcfadin

Context

The user_activity table schema exists in docs/schema-astra.cql (line 362) but has zero application code. The video_activity table is already implemented with write (view tracking) and read (trending) paths. This epic adds full read/write support for user_activity, tracking views, comments, and ratings — including anonymous video views via a sentinel UUID.

Scope

  • Write: Insert user_activity rows on every video view, comment, and rating
  • Read: New GET /users/{user_id}/activity paginated endpoint
  • Anonymous support: Video views from unauthenticated users use nil UUID 00000000-0000-0000-0000-000000000000
  • Error isolation: Activity tracking failures never break the parent operation (view/comment/rate)

Child Issues

Dependency Graph

#13 [M] — Create service + model (no deps)
  ├── #14 [M] — Video views integration
  ├── #15 [S] — Comments integration
  ├── #16 [S] — Ratings integration
  └── #17 [M] — GET endpoint
          └── #18 [L] — Comprehensive tests (all of 13-17)

Issues 14, 15, 16, 17 can run in parallel after Issue 13. Issue 18 is last.

Verification

After all issues are complete, verify end-to-end:

  1. pytest — all tests pass, no regressions
  2. python scripts/generate_openapi.py — regenerates docs/killrvideo_openapi.yaml with new endpoint, schema, and query params
  3. Inspect docs/killrvideo_openapi.yaml — confirm /api/v1/users/{user_id_path}/activity path exists with activity_type query param and UserActivityResponse in components/schemas
  4. Manual: POST a video view (unauthenticated) → check user_activity row with nil UUID
  5. Manual: POST a video view (authenticated) → check user_activity row with real user ID
  6. Manual: POST a comment → check user_activity row with activity_type="comment"
  7. Manual: POST a rating → check user_activity row with activity_type="rate"
  8. Manual: GET /api/v1/users/{user_id}/activity → see paginated timeline
  9. Manual: GET with ?activity_type=view → filtered results

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions