Skip to content

Add Paginated GET /api/documents Endpoint with Filters for Status, Risk Score, Date Range, and Title Search #233

@mftee

Description

@mftee

Description:
Add a paginated search and filtering endpoint as an independent query feature so users can query their uploaded documents by status, risk score, date range, and keyword.

Tasks:

  • Implement GET /api/documents with query params: status, min_risk_score, max_risk_score, from_date, to_date, search (matches document title), page, limit
  • Use TypeORM QueryBuilder to construct the dynamic query
  • Return: { data: DocumentDto[], total: number, page: number, limit: number }
  • Regular users see only their own documents; admin users see all documents
  • Protect the route with JwtAuthGuard

Acceptance Criteria:

  • All filter params are optional and combinable
  • Pagination defaults to page=1, limit=20, max limit=100
  • The search param performs a case-insensitive partial match on title
  • Admin users can see documents belonging to any user

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions