Skip to content

Commit

Permalink
adding endpoints to list more information
Browse files Browse the repository at this point in the history
  • Loading branch information
mikecot committed Jan 10, 2024
1 parent c9cff05 commit cab97bd
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions src/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,57 @@ server.get('/providers', providersOpts, requestCache.handleRequestWithCache(asyn
}
}))

const specssOpts: RouteShorthandOptions = {
schema: {
response: {
200: {
type: 'object',
properties: {
specs: {
type: 'array',
},
}
}
}
}
}

server.get('/specs', specssOpts, requestCache.handleRequestWithCache(async (request: FastifyRequest, reply: FastifyReply) => {
await checkDb()

const res = await db.select().from(schema.specs)

return {
specs: res,
}
}))

const consumersOpts: RouteShorthandOptions = {
schema: {
response: {
200: {
type: 'object',
properties: {
consumers: {
type: 'array',
},
}
}
}
}
}

server.get('/consumers', consumersOpts, requestCache.handleRequestWithCache(async (request: FastifyRequest, reply: FastifyReply) => {
await checkDb()

const res = await db.select().from(schema.consumers)

return {
consumers: res,
}
}))


const consumerOpts: RouteShorthandOptions = {
schema: {
response: {
Expand Down

0 comments on commit cab97bd

Please sign in to comment.