mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 08:13:56 +10:00
This PR is handles the changes required to support envelopes. The new envelope editor/signing page will be hidden during release. The core changes here is to migrate the documents and templates model to a centralized envelopes model. Even though Documents and Templates are removed, from the user perspective they will still exist as we remap envelopes to documents and templates.
39 lines
913 B
TypeScript
39 lines
913 B
TypeScript
import { deleteDocument } from '@documenso/lib/server-only/document/delete-document';
|
|
|
|
import { authenticatedProcedure } from '../trpc';
|
|
import {
|
|
ZDeleteDocumentRequestSchema,
|
|
ZDeleteDocumentResponseSchema,
|
|
deleteDocumentMeta,
|
|
} from './delete-document.types';
|
|
import { ZGenericSuccessResponse } from './schema';
|
|
|
|
export const deleteDocumentRoute = authenticatedProcedure
|
|
.meta(deleteDocumentMeta)
|
|
.input(ZDeleteDocumentRequestSchema)
|
|
.output(ZDeleteDocumentResponseSchema)
|
|
.mutation(async ({ input, ctx }) => {
|
|
const { teamId } = ctx;
|
|
const { documentId } = input;
|
|
|
|
ctx.logger.info({
|
|
input: {
|
|
documentId,
|
|
},
|
|
});
|
|
|
|
const userId = ctx.user.id;
|
|
|
|
await deleteDocument({
|
|
id: {
|
|
type: 'documentId',
|
|
id: documentId,
|
|
},
|
|
userId,
|
|
teamId,
|
|
requestMetadata: ctx.metadata,
|
|
});
|
|
|
|
return ZGenericSuccessResponse;
|
|
});
|