Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/api/src/controllers/account-balance/historical.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
HistoricalBalanceRequestQuerySchema,
HistoricalBalancesResponseSchema,
} from "@/mappers";
import { setCacheControl } from "@/middlewares";
import { HistoricalBalancesService } from "@/services";

export function historicalBalances(
Expand All @@ -21,6 +22,7 @@ export function historicalBalances(
description:
"Returns historical balance deltas for one account, enriched with the transfer that caused each change.",
tags: ["account-balances"],
middleware: [setCacheControl(60)],
request: {
params: HistoricalBalanceRequestParamsSchema,
query: HistoricalBalanceRequestQuerySchema,
Expand Down
3 changes: 3 additions & 0 deletions apps/api/src/controllers/account-balance/interactions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Address } from "viem";
import { OpenAPIHono as Hono, createRoute } from "@hono/zod-openapi";

import { setCacheControl } from "@/middlewares";

import {
AccountInteractions,
AccountInteractionsMapper,
Expand Down Expand Up @@ -33,6 +35,7 @@ export function accountInteractions(app: Hono, service: InteractionsService) {
description: `Returns a mapping of the largest interactions between accounts.
Positive amounts signify net token transfers FROM <address>, whilst negative amounts refer to net transfers TO <address>`,
tags: ["account-balances"],
middleware: [setCacheControl(60)],
request: {
params: AccountInteractionsParamsSchema,
query: AccountInteractionsQuerySchema,
Expand Down
3 changes: 3 additions & 0 deletions apps/api/src/controllers/account-balance/listing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
AccountBalanceWithVariationResponseMapper,
AccountBalanceWithVariationResponseSchema,
} from "@/mappers";
import { setCacheControl } from "@/middlewares";
import { AccountBalanceService } from "@/services";

export function accountBalances(
Expand All @@ -25,6 +26,7 @@ export function accountBalances(
summary: "Get account balance records",
description: "Returns sorted and paginated account balance records",
tags: ["account-balances"],
middleware: [setCacheControl(60)],
request: {
query: AccountBalancesRequestSchema,
},
Expand Down Expand Up @@ -94,6 +96,7 @@ export function accountBalances(
summary: "Get account balance",
description: "Returns account balance information for a specific address",
tags: ["account-balances"],
middleware: [setCacheControl(60)],
request: {
params: AccountBalanceRequestParamSchema,
query: AccountBalanceRequestQuerySchema,
Expand Down
3 changes: 3 additions & 0 deletions apps/api/src/controllers/account-balance/variations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
AccountBalanceVariationsByAccountIdResponseMapper,
AccountBalanceVariationsByAccountIdResponseSchema,
} from "@/mappers";
import { setCacheControl } from "@/middlewares";
import { BalanceVariationsService } from "@/services";

export function accountBalanceVariations(
Expand All @@ -24,6 +25,7 @@ export function accountBalanceVariations(
description:
"Returns a mapping of the biggest variations to account balances associated by account address",
tags: ["account-balances"],
middleware: [setCacheControl(60)],
request: {
query: AccountBalanceVariationsRequestQuerySchema,
},
Expand Down Expand Up @@ -66,6 +68,7 @@ export function accountBalanceVariations(
summary: "Get changes in balance for a given period for a single account",
description: "Returns a the changes to balance by period and accountId",
tags: ["account-balances"],
middleware: [setCacheControl(60)],
request: {
params: AccountBalanceVariationsByAccountIdRequestParamsSchema,
query: AccountBalanceVariationsByAccountIdRequestQuerySchema,
Expand Down
2 changes: 2 additions & 0 deletions apps/api/src/controllers/dao/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { OpenAPIHono as Hono, createRoute } from "@hono/zod-openapi";

import { DaoResponseSchema } from "@/mappers";
import { setCacheControl } from "@/middlewares";
import { DaoService } from "@/services";

export function dao(app: Hono, service: DaoService) {
Expand All @@ -12,6 +13,7 @@ export function dao(app: Hono, service: DaoService) {
summary: "Get DAO governance parameters",
description: "Returns current governance parameters for this DAO",
tags: ["governance"],
middleware: [setCacheControl(3600)],
responses: {
200: {
description: "DAO governance parameters",
Expand Down
2 changes: 2 additions & 0 deletions apps/api/src/controllers/delegation-percentage/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
DelegationPercentageResponseSchema,
toApi,
} from "@/mappers/";
import { setCacheControl } from "@/middlewares";
import { DelegationPercentageService } from "@/services";

export function delegationPercentage(
Expand All @@ -18,6 +19,7 @@ export function delegationPercentage(
path: "/delegation-percentage",
summary: "Get delegation percentage day buckets with forward-fill",
tags: ["metrics"],
middleware: [setCacheControl(3600)],
request: {
query: DelegationPercentageRequestSchema,
},
Expand Down
2 changes: 2 additions & 0 deletions apps/api/src/controllers/delegations/delegations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
DelegationsResponseSchema,
} from "@/mappers/delegations";
import {} from "@/mappers";
import { setCacheControl } from "@/middlewares";

import { DelegationsService } from "@/services/delegations/current";

Expand All @@ -17,6 +18,7 @@ export function delegations(app: Hono, service: DelegationsService) {
summary: "Get delegations",
description: "Get current delegations for an account",
tags: ["delegations"],
middleware: [setCacheControl(60)],
request: {
params: DelegationsRequestParamsSchema,
},
Expand Down
2 changes: 2 additions & 0 deletions apps/api/src/controllers/delegations/delegators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
DelegatorsRequestQuerySchema,
} from "@/mappers/delegations/delegators";
import {} from "@/mappers";
import { setCacheControl } from "@/middlewares";
import { DelegatorsService } from "@/services/delegations/delegators";

export function delegators(app: Hono, service: DelegatorsService) {
Expand All @@ -17,6 +18,7 @@ export function delegators(app: Hono, service: DelegatorsService) {
summary: "Get delegators",
description: "Get current delegators of an account with voting power",
tags: ["delegations"],
middleware: [setCacheControl(60)],
request: {
params: DelegatorsRequestParamsSchema,
query: DelegatorsRequestQuerySchema,
Expand Down
2 changes: 2 additions & 0 deletions apps/api/src/controllers/delegations/historical.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
DelegationsResponseSchema,
} from "@/mappers/delegations";
import {} from "@/mappers";
import { setCacheControl } from "@/middlewares";

import { HistoricalDelegationsService } from "@/services/delegations";

Expand All @@ -22,6 +23,7 @@ export function historicalDelegations(
description:
"Get historical delegations for an account, with optional filtering and sorting",
tags: ["delegations"],
middleware: [setCacheControl(60)],
request: {
params: HistoricalDelegationsRequestParamsSchema,
query: HistoricalDelegationsRequestQuerySchema,
Expand Down
2 changes: 2 additions & 0 deletions apps/api/src/controllers/event-relevance/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
EventRelevanceThresholdQuerySchema,
EventRelevanceThresholdResponseSchema,
} from "@/mappers";
import { setCacheControl } from "@/middlewares";
import { EventRelevanceService } from "@/services";

export function eventRelevance(app: Hono, service: EventRelevanceService) {
Expand All @@ -16,6 +17,7 @@ export function eventRelevance(app: Hono, service: EventRelevanceService) {
path: "/event-relevance/threshold",
summary: "Get event relevance threshold",
tags: ["feed"],
middleware: [setCacheControl(3600)],
request: {
query: EventRelevanceThresholdQuerySchema,
},
Expand Down
2 changes: 2 additions & 0 deletions apps/api/src/controllers/feed/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { OpenAPIHono as Hono, createRoute } from "@hono/zod-openapi";

import { FeedRequestSchema, FeedResponseSchema } from "@/mappers";
import { setCacheControl } from "@/middlewares";
import { FeedService } from "@/services";

export function feed(app: Hono, service: FeedService) {
Expand All @@ -11,6 +12,7 @@ export function feed(app: Hono, service: FeedService) {
path: "/feed/events",
summary: "Get feed events",
tags: ["feed"],
middleware: [setCacheControl(60)],
request: {
query: FeedRequestSchema,
},
Expand Down
5 changes: 5 additions & 0 deletions apps/api/src/controllers/governance-activity/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { OpenAPIHono as Hono, createRoute } from "@hono/zod-openapi";
import { formatEther } from "viem";

import { DaysEnum } from "@/lib/enums";
import { setCacheControl } from "@/middlewares";
import {
ActiveSupplyResponseSchema,
AverageTurnoutComparisonResponseSchema,
Expand Down Expand Up @@ -40,6 +41,7 @@ export function governanceActivity(
path: "/active-supply/compare",
summary: "Get active token supply for DAO",
tags: ["governance"],
middleware: [setCacheControl(60)],
request: {
query: GovernanceActivityDaysQuerySchema,
},
Expand Down Expand Up @@ -68,6 +70,7 @@ export function governanceActivity(
path: "/proposals/compare",
summary: "Compare number of proposals between time periods",
tags: ["governance"],
middleware: [setCacheControl(60)],
request: {
query: GovernanceActivityDaysQuerySchema,
},
Expand Down Expand Up @@ -117,6 +120,7 @@ export function governanceActivity(
path: "/votes/compare",
summary: "Compare number of votes between time periods",
tags: ["governance"],
middleware: [setCacheControl(60)],
request: {
query: GovernanceActivityDaysQuerySchema,
},
Expand Down Expand Up @@ -165,6 +169,7 @@ export function governanceActivity(
path: "/average-turnout/compare",
summary: "Compare average turnout between time periods",
tags: ["governance"],
middleware: [setCacheControl(60)],
request: {
query: GovernanceActivityDaysQuerySchema,
},
Expand Down
2 changes: 2 additions & 0 deletions apps/api/src/controllers/last-update/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { OpenAPIHono as Hono, createRoute } from "@hono/zod-openapi";

import { Drizzle } from "@/database";
import { LastUpdateQuerySchema, LastUpdateResponseSchema } from "@/mappers/";
import { setCacheControl } from "@/middlewares";
import { LastUpdateRepositoryImpl } from "@/repositories";
import { LastUpdateService } from "@/services";

Expand All @@ -15,6 +16,7 @@ export function lastUpdate(app: Hono, db: Drizzle) {
path: "/last-update",
summary: "Get the last update time",
tags: ["metrics"],
middleware: [setCacheControl(30)],
request: {
query: LastUpdateQuerySchema,
},
Expand Down
3 changes: 3 additions & 0 deletions apps/api/src/controllers/proposals/offchainProposals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
OffchainProposalsResponseSchema,
OffchainProposalsRequestSchema,
} from "@/mappers";
import { setCacheControl } from "@/middlewares";
import { OffchainProposalsService } from "@/services";

export function offchainProposals(
Expand All @@ -22,6 +23,7 @@ export function offchainProposals(
summary: "Get offchain proposals",
description: "Returns a list of offchain (Snapshot) proposals",
tags: ["offchain"],
middleware: [setCacheControl(60)],
request: {
query: OffchainProposalsRequestSchema,
},
Expand Down Expand Up @@ -97,6 +99,7 @@ export function offchainProposals(
summary: "Get an offchain proposal by ID",
description: "Returns a single offchain (Snapshot) proposal by its ID",
tags: ["offchain"],
middleware: [setCacheControl(60)],
request: {
params: OffchainProposalRequestSchema,
},
Expand Down
3 changes: 3 additions & 0 deletions apps/api/src/controllers/proposals/onchainProposals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
ProposalResponseSchema,
ProposalMapper,
} from "@/mappers";
import { setCacheControl } from "@/middlewares";
import { ProposalsService } from "@/services";

export function proposals(
Expand All @@ -26,6 +27,7 @@ export function proposals(
summary: "Get proposals",
description: "Returns a list of proposal",
tags: ["proposals"],
middleware: [setCacheControl(60)],
request: {
query: ProposalsRequestSchema,
},
Expand Down Expand Up @@ -134,6 +136,7 @@ export function proposals(
summary: "Get a proposal by ID",
description: "Returns a single proposal by its ID",
tags: ["proposals"],
middleware: [setCacheControl(60)],
request: {
params: ProposalRequestSchema,
},
Expand Down
2 changes: 2 additions & 0 deletions apps/api/src/controllers/proposals/proposals-activity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
ProposalActivityRequestSchema,
ProposalActivityResponseSchema,
} from "@/mappers";
import { setCacheControl } from "@/middlewares";
import { DrizzleProposalsActivityRepository } from "@/repositories/";
import { ProposalsActivityService } from "@/services";

Expand All @@ -27,6 +28,7 @@ export function proposalsActivity(
description:
"Returns proposal activity data including voting history, win rates, and detailed proposal information for the specified delegate within the given time window",
tags: ["proposals"],
middleware: [setCacheControl(60)],
request: {
query: ProposalActivityRequestSchema,
},
Expand Down
2 changes: 2 additions & 0 deletions apps/api/src/controllers/token-metrics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
toTokenMetricsApi,
} from "@/mappers/token-metrics";
import {} from "@/mappers";
import { setCacheControl } from "@/middlewares";

import { TokenMetricsService } from "@/services/token-metrics";

Expand All @@ -18,6 +19,7 @@ export function tokenMetrics(app: Hono, service: TokenMetricsService) {
summary: "Get token related metrics",
description: `Returns token related metrics for a single metric type.`,
tags: ["metrics"],
middleware: [setCacheControl(3600)],
request: {
query: TokenMetricsRequestSchema,
},
Expand Down
2 changes: 2 additions & 0 deletions apps/api/src/controllers/token/token-distribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { formatUnits, parseEther } from "viem";

import { MetricTypesEnum } from "@/lib/constants";
import { DaysEnum, SECONDS_IN_DAY } from "@/lib/enums";
import { setCacheControl } from "@/middlewares";
import {
SupplyComparisonResponseSchema,
TokenDistributionComparisonQuerySchema,
Expand Down Expand Up @@ -42,6 +43,7 @@ export function tokenDistribution(
path: `/${path}/compare`,
summary: `Compare ${path.replace(/-/g, " ")} between periods`,
tags: ["tokens"],
middleware: [setCacheControl(60)],
request: {
query: TokenDistributionComparisonQuerySchema,
},
Expand Down
2 changes: 2 additions & 0 deletions apps/api/src/controllers/token/token-historical-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
TokenHistoricalPriceRequest,
TokenHistoricalPriceResponse,
} from "@/mappers";
import { setCacheControl } from "@/middlewares";

export interface TokenHistoricalDataClient {
getHistoricalTokenData(
Expand All @@ -24,6 +25,7 @@ export function tokenHistoricalData(
summary: "Get historical token data",
description: "Get historical market data for a specific token",
tags: ["tokens"],
middleware: [setCacheControl(3600)],
request: {
query: TokenHistoricalPriceRequest,
},
Expand Down
2 changes: 2 additions & 0 deletions apps/api/src/controllers/token/token-properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
TokenPropertiesResponseSchema,
TokenMapper,
} from "@/mappers";
import { setCacheControl } from "@/middlewares";
import { TokenService } from "@/services";

export interface TokenPriceClient {
Expand Down Expand Up @@ -39,6 +40,7 @@ export function token(
summary: "Get token properties",
description: "Get property data for a specific token",
tags: ["tokens"],
middleware: [setCacheControl(3600)],
request: {
query: TokenPropertiesQuerySchema,
},
Expand Down
2 changes: 2 additions & 0 deletions apps/api/src/controllers/transactions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
TransactionsRequestSchema,
TransactionsResponseSchema,
} from "@/mappers/";
import { setCacheControl } from "@/middlewares";
import { TransactionsService } from "@/services";

export function transactions(app: Hono, service: TransactionsService) {
Expand All @@ -16,6 +17,7 @@ export function transactions(app: Hono, service: TransactionsService) {
description:
"Get transactions with their associated transfers and delegations, with optional filtering and sorting",
tags: ["transactions"],
middleware: [setCacheControl(60)],
request: {
query: TransactionsRequestSchema,
},
Expand Down
Loading
Loading