From bc84b7b550b7370335a9f17b7b588e6195165631 Mon Sep 17 00:00:00 2001 From: Vladimir Volek Date: Tue, 5 Dec 2023 16:25:56 +0100 Subject: [PATCH] chore: changelog fix: types fix: types fix: types --- .vscode/settings.json | 1 + CHANGELOG.md | 4 ++++ src/routes/governance/dreps/hash/distribution.ts | 3 ++- src/routes/governance/dreps/hash/index.ts | 3 ++- src/routes/governance/dreps/index.ts | 3 ++- src/types/queries/blocks.ts | 1 - src/types/queries/epochs.ts | 1 - src/types/queries/governance.ts | 12 ++++++++++++ 8 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 src/types/queries/governance.ts 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/CHANGELOG.md b/CHANGELOG.md index c141d2d2..a8ec50a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- `/governance/dreps` +- `/governance/dreps/{hash}` +- `/governance/dreps/{hash}/distribution` +- feature flag to turn on/off `CIP-1694` support - support for Cardano Sanchonet - translation of cost models from numerical IDs to strings, required for `cardano-db-sync 13.1.1.3` and newer [#130](https://github.com/blockfrost/blockfrost-backend-ryo/pull/130) 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/blocks.ts b/src/types/queries/blocks.ts index 2a94d1f9..d0f1290a 100644 --- a/src/types/queries/blocks.ts +++ b/src/types/queries/blocks.ts @@ -4,7 +4,6 @@ export type { ResultFound } from '../common.js'; export interface RequestParameters { Params: { hash_or_number: string; - hash: string; }; Querystring: { count: number; diff --git a/src/types/queries/epochs.ts b/src/types/queries/epochs.ts index 29a72342..b4bc780e 100644 --- a/src/types/queries/epochs.ts +++ b/src/types/queries/epochs.ts @@ -7,7 +7,6 @@ export interface RequestParameters { Querystring: { count: number; page: number; - order: 'asc' | 'desc'; }; } 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; + }; +}