Skip to content

GET /splits Pagination: Return Total Project Count #642

Description

@SheyeJDev

Problem: GET /splits returns an array of projects but does not return the total project count. Frontend clients cannot show "Page X of Y" or know when they've reached the last page — they only know when a page returns fewer results than limit. The contract exposes get_project_count() but the backend API never calls it.

Scope: Add total and hasMore fields to the GET /splits response.

Implementation guidance:
In the GET /splits handler, after fetching the projects array, also call simulateReadOnlyContractCall with get_project_count.
Include total, start, limit, hasMore: start + projects.length < total in the response body.
Cache the total count alongside the project list (same TTL).

Acceptance criteria: GET /splits?start=0&limit=10 returns { projects: [...], total: 42, hasMore: true }; hasMore is false on the last page.

Validation: Unit test with a mocked contract returning 15 projects; assert hasMore: true on page 1 and hasMore: false on page 2.

Files to modify: backend/src/routes/splits.ts, backend/src/services/splits.service.ts

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave programbackendExpress API (Node/TS) workenhancementNew 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