Documents list API: pagination, search, sort, personal/company scope #60

Closed
opened 2026-08-02 04:37:15 -07:00 by westfarn · 0 comments
Owner

Parent epic: chat_backend#42
Related: #46
Related FE: chat_web_app#93

Summary

GET /documents/ currently returns the full list for one workspace via ensure_workspace_for_user. Business users need personal and company docs; lists will grow with Drive sync — need pagination, search, and sort.

API changes

GET /documents/ (or scoped variant) should support:

  • Pagination — page / page_size (or limit/offset); response includes total count
  • Search — filter by filename / remote name (case-insensitive)
  • Sort — columns at least: name, date uploaded (created), processed, active
  • Scope — query param e.g. workspace=personal|company (or workspace id)
    • Personal plan / non-company users: personal only
    • Company members: can list personal workspace docs and company workspace docs separately
    • Enforce auth: company scope only if user belongs to that company; uploads/mutations stay correctly scoped

Acceptance

  • Paginated response (not unbounded dump)
  • Search by name works
  • Sort by supported columns (asc/desc)
  • Personal vs company scope filter for business users
  • Tests for pagination, search, sort, and scope isolation
Parent epic: [chat_backend#42](https://git.aimloperations.com/ai_ml_operations/chat_backend/issues/42) Related: [#46](https://git.aimloperations.com/ai_ml_operations/chat_backend/issues/46) Related FE: [chat_web_app#93](https://git.aimloperations.com/ai_ml_operations/chat_web_app/issues/93) ## Summary `GET /documents/` currently returns the full list for one workspace via `ensure_workspace_for_user`. Business users need personal **and** company docs; lists will grow with Drive sync — need pagination, search, and sort. ## API changes `GET /documents/` (or scoped variant) should support: - **Pagination** — page / page_size (or limit/offset); response includes total count - **Search** — filter by filename / remote name (case-insensitive) - **Sort** — columns at least: name, date uploaded (`created`), processed, active - **Scope** — query param e.g. `workspace=personal|company` (or workspace id) - Personal plan / non-company users: personal only - Company members: can list personal workspace docs and company workspace docs separately - Enforce auth: company scope only if user belongs to that company; uploads/mutations stay correctly scoped ## Acceptance - [ ] Paginated response (not unbounded dump) - [ ] Search by name works - [ ] Sort by supported columns (asc/desc) - [ ] Personal vs company scope filter for business users - [ ] Tests for pagination, search, sort, and scope isolation
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ai_ml_operations/chat_backend#60