Skip to content

Commit

Permalink
Fix deployment sorting + bump api version
Browse files Browse the repository at this point in the history
  • Loading branch information
Redm4x committed Feb 15, 2024
1 parent d275abb commit 22448f4
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 19 deletions.
4 changes: 2 additions & 2 deletions api/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cloudmos-api",
"version": "2.14.5",
"version": "2.14.6",
"description": "Api providing data to the deploy tool",
"author": "Cloudmos",
"license": "Apache-2.0",
Expand Down
17 changes: 16 additions & 1 deletion api/src/routers/legacyRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,22 @@ legacyRouter.get("/addresses/:address/deployments/:skip/:limit", async (c) => {
const address = c.req.param("address");
const skip = c.req.param("skip");
const limit = c.req.param("limit");
return c.redirect(`/v1/addresses/${address}/deployments/${skip}/${limit}`, redirectStatusCode);
const status = c.req.query("status");
const reverseSorting = c.req.query("reverseSorting");

const urlParams = new URLSearchParams("");

if (status) {
urlParams.append("status", status);
}

if (reverseSorting) {
urlParams.append("reverseSorting", reverseSorting);
}

const q = urlParams.toString();

return c.redirect(`/v1/addresses/${address}/deployments/${skip}/${limit}${q ? "?" + q : ""}`, redirectStatusCode);
});

legacyRouter.get("/providers/:address", async (c) => {
Expand Down
23 changes: 8 additions & 15 deletions api/src/routes/v1/addresses/deployments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,14 @@ const route = createRoute({
})
}),
query: z.object({
status: z
.string()
.optional()
.openapi({
description: "Filter by status", // TODO: Set possible statuses?
example: "closed"
}),
reverseSorting: z
.string()
.optional()
.openapi({
param: { name: "reverseSorting", in: "query" },
description: "Reverse sorting",
example: "true"
})
status: z.string().optional().openapi({
description: "Filter by status", // TODO: Set possible statuses?
example: "closed"
}),
reverseSorting: z.string().optional().openapi({
description: "Reverse sorting",
example: "true"
})
})
},
responses: {
Expand Down

0 comments on commit 22448f4

Please sign in to comment.