diff --git a/apps/api/src/api-v1/consumers/admin-get-consumer-by-token.ts b/apps/api/src/api-v1/consumers/admin-get-consumer-by-token.ts index 223a9264..7604ada8 100644 --- a/apps/api/src/api-v1/consumers/admin-get-consumer-by-token.ts +++ b/apps/api/src/api-v1/consumers/admin-get-consumer-by-token.ts @@ -13,7 +13,7 @@ import { import { consumerTokenParamsSchema, populateConsumerSchema } from './schemas' const route = createRoute({ - description: 'Gets a consumer by API token', + description: 'Gets a consumer by API token (admin-only)', tags: ['admin', 'consumers'], operationId: 'adminGetConsumerByToken', method: 'get', @@ -25,7 +25,7 @@ const route = createRoute({ }, responses: { 200: { - description: 'A consumer object', + description: 'An admin consumer object', content: { 'application/json': { schema: schema.consumerSelectSchema diff --git a/apps/api/src/api-v1/deployments/admin-get-deployment-by-identifier copy.ts b/apps/api/src/api-v1/deployments/admin-get-deployment-by-identifier.ts similarity index 80% rename from apps/api/src/api-v1/deployments/admin-get-deployment-by-identifier copy.ts rename to apps/api/src/api-v1/deployments/admin-get-deployment-by-identifier.ts index e21247db..60cda7f2 100644 --- a/apps/api/src/api-v1/deployments/admin-get-deployment-by-identifier copy.ts +++ b/apps/api/src/api-v1/deployments/admin-get-deployment-by-identifier.ts @@ -15,7 +15,7 @@ import { deploymentIdentifierAndPopulateSchema } from './schemas' const route = createRoute({ description: 'Gets a deployment by its public identifier (admin-only)', - tags: ['deployments'], + tags: ['admin', 'deployments'], operationId: 'adminGetDeploymentByIdentifier', method: 'get', path: 'admin/deployments/by-identifier', @@ -52,6 +52,20 @@ export function registerV1AdminDeploymentsGetDeploymentByIdentifier( assert(deployment, 404, `Deployment not found "${deploymentIdentifier}"`) await acl(c, deployment, { label: 'Deployment' }) + // TODO + // TODO: switch from published to publishedAt? + // if (deployment.published) { + // c.res.headers.set( + // 'cache-control', + // 'public, max-age=1, s-maxage=1 stale-while-revalidate=1' + // ) + // } else { + // c.res.headers.set( + // 'cache-control', + // 'public, max-age=120, s-maxage=120, stale-while-revalidate=10' + // ) + // } + return c.json( parseZodSchema(schema.deploymentAdminSelectSchema, deployment) ) diff --git a/apps/api/src/api-v1/index.ts b/apps/api/src/api-v1/index.ts index 02414007..e3a4cb4a 100644 --- a/apps/api/src/api-v1/index.ts +++ b/apps/api/src/api-v1/index.ts @@ -11,7 +11,7 @@ import { registerV1ConsumersGetConsumer } from './consumers/get-consumer' import { registerV1ProjectsListConsumers } from './consumers/list-consumers' import { registerV1ConsumersRefreshConsumerToken } from './consumers/refresh-consumer-token' import { registerV1ConsumersUpdateConsumer } from './consumers/update-consumer' -import { registerV1AdminDeploymentsGetDeploymentByIdentifier } from './deployments/admin-get-deployment-by-identifier copy' +import { registerV1AdminDeploymentsGetDeploymentByIdentifier } from './deployments/admin-get-deployment-by-identifier' import { registerV1DeploymentsCreateDeployment } from './deployments/create-deployment' import { registerV1DeploymentsGetDeployment } from './deployments/get-deployment' import { registerV1DeploymentsGetDeploymentByIdentifier } from './deployments/get-deployment-by-identifier'