-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(deployment): add new endpoint to query filtered bids for trial a…
…ccounts
- Loading branch information
Showing
10 changed files
with
116 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { z } from "zod"; | ||
|
||
// TODO: Extract into a types package | ||
const BidOutputSchema = z.object({ | ||
bid_id: z.object({ | ||
owner: z.string().openapi({}), | ||
dseq: z.string().openapi({}), | ||
gseq: z.number().openapi({}), | ||
oseq: z.number().openapi({}), | ||
provider: z.string().openapi({}) | ||
}), | ||
state: z.string().openapi({}), | ||
price: z.object({ | ||
denom: z.string().openapi({}), | ||
amount: z.string().openapi({}) | ||
}), | ||
created_at: z.string().openapi({}), | ||
resources_offer: z.array( | ||
z.object({ | ||
resources: z.object({ | ||
id: z.number().openapi({}) | ||
}) | ||
}) | ||
) | ||
}); | ||
|
||
export const BidListResponseOutputSchema = z.object({ | ||
bids: z.array(BidOutputSchema) | ||
}); | ||
export type BidListOutputResponse = z.infer<typeof BidListResponseOutputSchema>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
apps/api/src/billing/routes/trial-bids/trial-bids.router.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { createRoute } from "@hono/zod-openapi"; | ||
import { container } from "tsyringe"; | ||
import { z } from "zod"; | ||
|
||
import { WalletController } from "@src/billing/controllers/wallet/wallet.controller"; | ||
import { BidListResponseOutputSchema } from "@src/billing/http-schemas/bids.schema"; | ||
import { OpenApiHonoHandled } from "@src/core/services/open-api-hono-handled/open-api-hono-handled"; | ||
|
||
export const GetTrialBidListRequestInputSchema = z.object({ | ||
address: z.string().openapi({}), | ||
dseq: z.string().openapi({}) | ||
}); | ||
export type GetTrialBidListRequestInput = z.infer<typeof GetTrialBidListRequestInputSchema>; | ||
|
||
const route = createRoute({ | ||
method: "get", | ||
path: "/v1/trial-bids", | ||
summary: "Get a list of bids for trial accounts", | ||
tags: ["Bids"], | ||
request: { | ||
query: GetTrialBidListRequestInputSchema | ||
}, | ||
responses: { | ||
200: { | ||
description: "Returns a list of bids for trial accounts", | ||
content: { | ||
"application/json": { | ||
schema: BidListResponseOutputSchema | ||
} | ||
} | ||
} | ||
} | ||
}); | ||
export const trialBidsRouter = new OpenApiHonoHandled(); | ||
|
||
trialBidsRouter.openapi(route, async function routeGetTrialBidList(c) { | ||
return c.json(await container.resolve(WalletController).getTrialBidList(c.req.valid("query")), 200); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters