fix: refactor token router (#1981)

This commit is contained in:
David Nguyen
2025-08-25 08:25:01 +10:00
committed by GitHub
parent 49fabeb0ec
commit b8d07fd1a6
12 changed files with 122 additions and 69 deletions

View File

@ -0,0 +1,27 @@
import { deleteTokenById } from '@documenso/lib/server-only/public-api/delete-api-token-by-id';
import { authenticatedProcedure } from '../trpc';
import {
ZDeleteApiTokenRequestSchema,
ZDeleteApiTokenResponseSchema,
} from './delete-api-token.types';
export const deleteApiTokenRoute = authenticatedProcedure
.input(ZDeleteApiTokenRequestSchema)
.output(ZDeleteApiTokenResponseSchema)
.mutation(async ({ input, ctx }) => {
const { id, teamId } = input;
ctx.logger.info({
input: {
id,
teamId,
},
});
await deleteTokenById({
id,
teamId,
userId: ctx.user.id,
});
});