From 14b9f34ec93c245733736b0a02bb5eef690689af Mon Sep 17 00:00:00 2001 From: 1000101 Date: Sun, 17 Dec 2023 19:33:00 +0100 Subject: [PATCH] fix(cip-1694): enable schema for delgators and updates --- src/routes/governance/dreps/drep-id/delegators.ts | 5 ++--- src/routes/governance/dreps/drep-id/updates.ts | 7 +++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/routes/governance/dreps/drep-id/delegators.ts b/src/routes/governance/dreps/drep-id/delegators.ts index 9246212f..e53c18fe 100644 --- a/src/routes/governance/dreps/drep-id/delegators.ts +++ b/src/routes/governance/dreps/drep-id/delegators.ts @@ -3,14 +3,13 @@ import * as QueryTypes from '../../../../types/queries/governance.js'; import * as ResponseTypes from '../../../../types/responses/governance.js'; import { getDbSync } from '../../../../utils/database.js'; import { SQLQuery } from '../../../../sql/index.js'; -//import { getSchemaForEndpoint } from '@blockfrost/openapi'; +import { getSchemaForEndpoint } from '@blockfrost/openapi'; async function route(fastify: FastifyInstance) { fastify.route({ url: '/governance/dreps/:drep_id/delegators', method: 'GET', - // TODO: SCHEMA - // schema: getSchemaForEndpoint('/governance/dreps/{drep_id}/delegators'), + schema: getSchemaForEndpoint('/governance/dreps/{drep_id}/delegators'), handler: async (request: FastifyRequest, reply) => { const clientDbSync = await getDbSync(fastify); diff --git a/src/routes/governance/dreps/drep-id/updates.ts b/src/routes/governance/dreps/drep-id/updates.ts index 3e13ca1a..2dfdab50 100644 --- a/src/routes/governance/dreps/drep-id/updates.ts +++ b/src/routes/governance/dreps/drep-id/updates.ts @@ -3,14 +3,13 @@ import * as QueryTypes from '../../../../types/queries/governance.js'; import * as ResponseTypes from '../../../../types/responses/governance.js'; import { getDbSync } from '../../../../utils/database.js'; import { SQLQuery } from '../../../../sql/index.js'; -//import { getSchemaForEndpoint } from '@blockfrost/openapi'; +import { getSchemaForEndpoint } from '@blockfrost/openapi'; async function route(fastify: FastifyInstance) { fastify.route({ url: '/governance/dreps/:drep_id/updates', method: 'GET', - // TODO: SCHEMA - // schema: getSchemaForEndpoint('/governance/dreps/{drep_id}/updates'), + schema: getSchemaForEndpoint('/governance/dreps/{drep_id}/updates'), handler: async (request: FastifyRequest, reply) => { const clientDbSync = await getDbSync(fastify); @@ -18,7 +17,7 @@ async function route(fastify: FastifyInstance) { const { rows }: { rows: ResponseTypes.DRepsDrepIDUpdates } = await clientDbSync.query( SQLQuery.get('governance_dreps_drep_id_updates'), - [request.query.order, request.query.count, request.query.page, request.params.drep_id], + [(request.query.order, request.query.count, request.query.page, request.params.drep_id)], ); clientDbSync.release();