Skip to content

Commit

Permalink
fix offset
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathieu Lefebvre committed Aug 6, 2024
1 parent 9b1d54d commit 54d780e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ export function getContracts(endpoint: UsageEndpoints, query_param: any, example
query += ` LIMIT {limit : int} `
if (q.page) query += ` OFFSET {offset: int} `


return query;
}
else {
Expand Down
2 changes: 1 addition & 1 deletion src/typespec/openapi3.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ alias AmountFilter = {
alias APIResponse<T> = T | APIError;
alias PaginationQueryParams = {
@query limit?: uint64 = 100;
@query page?: uint64 = 1;
@query page?: uint64 = 0;
};

// Helper aliases for accessing underlying properties
Expand Down
1 change: 1 addition & 0 deletions src/usage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export async function makeUsageQuery(ctx: Context, endpoint: UsageEndpoints, use
let query_results;

try {
console.log(user_params,additional_query_params)
query_results = await makeQuery<EndpointElementReturnType>(query, { ...user_params, ...additional_query_params, limit, offset });
} catch (err) {
return APIErrorResponse(ctx, 500, "bad_database_response", err);
Expand Down
12 changes: 6 additions & 6 deletions tsp-output/@typespec/openapi3/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"schema": {
"type": "integer",
"format": "uint64",
"default": 1
"default": 0
}
}
],
Expand Down Expand Up @@ -285,7 +285,7 @@
"schema": {
"type": "integer",
"format": "uint64",
"default": 1
"default": 0
}
}
],
Expand Down Expand Up @@ -379,7 +379,7 @@
"schema": {
"type": "integer",
"format": "uint64",
"default": 1
"default": 0
}
}
],
Expand Down Expand Up @@ -554,7 +554,7 @@
"schema": {
"type": "integer",
"format": "uint64",
"default": 1
"default": 0
}
}
],
Expand Down Expand Up @@ -666,7 +666,7 @@
"schema": {
"type": "integer",
"format": "uint64",
"default": 1
"default": 0
}
}
],
Expand Down Expand Up @@ -751,7 +751,7 @@
"schema": {
"type": "integer",
"format": "uint64",
"default": 1
"default": 0
}
}
],
Expand Down

0 comments on commit 54d780e

Please sign in to comment.