mirror of
https://github.com/documenso/documenso.git
synced 2025-11-10 04:22:32 +10:00
37 lines
898 B
TypeScript
37 lines
898 B
TypeScript
import { deleteAttachment } from '@documenso/lib/server-only/envelope-attachment/delete-attachment';
|
|
|
|
import { authenticatedProcedure } from '../../trpc';
|
|
import {
|
|
ZDeleteAttachmentRequestSchema,
|
|
ZDeleteAttachmentResponseSchema,
|
|
} from './delete-attachment.types';
|
|
|
|
export const deleteAttachmentRoute = authenticatedProcedure
|
|
.meta({
|
|
openapi: {
|
|
method: 'POST',
|
|
path: '/document/attachment/delete',
|
|
summary: 'Delete attachment',
|
|
description: 'Delete an attachment from a document',
|
|
tags: ['Document'],
|
|
},
|
|
})
|
|
.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,
|
|
});
|
|
});
|