mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 00:03:33 +10:00
33 lines
822 B
TypeScript
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;
|
|
});
|