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
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