-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
980cccf
commit 759e2ee
Showing
2 changed files
with
21 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import type { FastifyInstance, FastifyRequest, FastifyReply } from 'fastify' | ||
import { locked } from '@/db/schema' | ||
|
||
import type { Database } from '@/db/drizzle' | ||
|
||
export function getOfframpQuotes(fastify: FastifyInstance) { | ||
fastify.get('/get-offramp-quotes', async (request, reply) => handleGetOfframpQuotes(fastify.db, request, reply)) | ||
} | ||
|
||
async function handleGetOfframpQuotes(db: Database, _request: FastifyRequest, reply: FastifyReply) { | ||
try { | ||
const offRampQuotes = await db.select({ amount: locked.amount }).from(locked) | ||
|
||
return reply.send({ offRampQuotes }) | ||
} catch (error) { | ||
console.error(error) | ||
return reply.status(500).send({ message: 'Internal server error' }) | ||
} | ||
} |
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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
import type { FastifyInstance } from 'fastify' | ||
|
||
import { getHealthRoute } from './getHealth' | ||
import { getOfframpQuotes } from './getOfframpQuotes' | ||
|
||
export function declareRoutes(fastify: FastifyInstance) { | ||
getHealthRoute(fastify) | ||
getOfframpQuotes(fastify) | ||
} |