Files
documenso/packages/trpc/server/envelope-router/attachment/delete-attachment.ts
Lucas Smith 68a3608aee fix: handle bracket notation arrays (#2178)
Co-authored-by: David Nguyen <davidngu28@gmail.com>
2025-11-12 16:38:06 +11:00

33 lines
822 B
TypeScript

import { deleteAttachment } from '@documenso/lib/server-only/envelope-attachment/delete-attachment';
import { ZGenericSuccessResponse } from '../../schema';
import { authenticatedProcedure } from '../../trpc';
import {
ZDeleteAttachmentRequestSchema,
ZDeleteAttachmentResponseSchema,
deleteAttachmentMeta,
} from './delete-attachment.types';
export const deleteAttachmentRoute = authenticatedProcedure
.meta(deleteAttachmentMeta)
.input(ZDeleteAttachmentRequestSchema)
.output(ZDeleteAttachmentResponseSchema)
.mutation(async ({ input, ctx }) => {
const { teamId } = ctx;
const userId = ctx.user.id;
const { id } = input;
ctx.logger.info({
input: { id },
});
await deleteAttachment({
id,
userId,
teamId,
});
return ZGenericSuccessResponse;
});