diff --git a/.vscode/settings.json b/.vscode/settings.json index 2b5e1536..f0ae692c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,6 +7,7 @@ "cdbsync", "dbsync", "delegators", + "Drep", "dreps", "elgohr", "emurgo", diff --git a/src/routes/governance/dreps/hash/distribution.ts b/src/routes/governance/dreps/hash/distribution.ts index 2774b43d..bd90da4e 100644 --- a/src/routes/governance/dreps/hash/distribution.ts +++ b/src/routes/governance/dreps/hash/distribution.ts @@ -3,6 +3,7 @@ import * as QueryTypes from '../../../../types/queries/blocks.js'; import * as ResponseTypes from '../../../../types/responses/blocks.js'; import { getDbSync } from '../../../../utils/database.js'; import { SQLQuery } from '../../../../sql/index.js'; +import { DrepRequestParameters } from '../../../../types/queries/governance.js'; async function route(fastify: FastifyInstance) { fastify.route({ @@ -10,7 +11,7 @@ async function route(fastify: FastifyInstance) { method: 'GET', // TODO: add schema when available // schema: getSchemaForEndpoint('/governance/dreps/{hash}/distribution'), - handler: async (request: FastifyRequest, reply) => { + handler: async (request: FastifyRequest, reply) => { const clientDbSync = await getDbSync(fastify); const { rows }: { rows: ResponseTypes.Block[] } = await clientDbSync.query( diff --git a/src/routes/governance/dreps/hash/index.ts b/src/routes/governance/dreps/hash/index.ts index 5233e843..91bf6eb2 100644 --- a/src/routes/governance/dreps/hash/index.ts +++ b/src/routes/governance/dreps/hash/index.ts @@ -4,6 +4,7 @@ import * as ResponseTypes from '../../../../types/responses/blocks.js'; import { getDbSync } from '../../../../utils/database.js'; import { handle404 } from '../../../../utils/error-handler.js'; import { SQLQuery } from '../../../../sql/index.js'; +import { DrepRequestParameters } from '../../../../types/queries/governance.js'; async function route(fastify: FastifyInstance) { fastify.route({ @@ -11,7 +12,7 @@ async function route(fastify: FastifyInstance) { method: 'GET', // TODO: add schema when available // schema: getSchemaForEndpoint('/governance/dreps/{hash}'), - handler: async (request: FastifyRequest, reply) => { + handler: async (request: FastifyRequest, reply) => { const clientDbSync = await getDbSync(fastify); const { rows }: { rows: ResponseTypes.Block[] } = await clientDbSync.query( diff --git a/src/routes/governance/dreps/index.ts b/src/routes/governance/dreps/index.ts index 8db93a61..4000cb04 100644 --- a/src/routes/governance/dreps/index.ts +++ b/src/routes/governance/dreps/index.ts @@ -3,6 +3,7 @@ import { SQLQuery } from '../../../sql/index.js'; import * as QueryTypes from '../../../types/queries/epochs.js'; import * as ResponseTypes from '../../../types/responses/epochs.js'; import { getDbSync } from '../../../utils/database.js'; +import { DrepRequestParameters } from '../../../types/queries/governance.js'; async function route(fastify: FastifyInstance) { fastify.route({ @@ -10,7 +11,7 @@ async function route(fastify: FastifyInstance) { method: 'GET', // TODO: add schema when available // schema: getSchemaForEndpoint('/epochs/latest'), - handler: async (request: FastifyRequest, reply) => { + handler: async (request: FastifyRequest, reply) => { const clientDbSync = await getDbSync(fastify); try { diff --git a/src/types/queries/governance.ts b/src/types/queries/governance.ts new file mode 100644 index 00000000..9125247e --- /dev/null +++ b/src/types/queries/governance.ts @@ -0,0 +1,12 @@ +import { Order } from '../common.js'; + +export interface DrepRequestParameters { + Params: { + hash: string; + }; + Querystring: { + count: number; + page: number; + order: Order; + }; +}