SudoSOS Back-end API / helpers / toResponse
Function: toResponse() ​
ts
function toResponse<R>(
records,
count,
pagination): object;Build a paginated response from a [records, count] tuple. Use this in controllers to wrap service results into the standard paginated response format.
Type Parameters ​
| Type Parameter |
|---|
R |
Parameters ​
| Parameter | Type | Description |
|---|---|---|
records | R[] | The records to include in the response |
count | number | The total number of matching records (before pagination) |
pagination | PaginationParameters | The pagination parameters used for the query |
Returns ​
object
_pagination ​
ts
_pagination: PaginationResult;records ​
ts
records: R[];