Files
documenso/packages/trpc/server/document-router/get-document.ts
David Nguyen 7f09ba72f4 feat: add envelopes (#2025)
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.
2025-10-14 21:56:36 +11:00

33 lines
789 B
TypeScript

import { getDocumentWithDetailsById } from '@documenso/lib/server-only/document/get-document-with-details-by-id';
import { authenticatedProcedure } from '../trpc';
import {
ZGetDocumentRequestSchema,
ZGetDocumentResponseSchema,
getDocumentMeta,
} from './get-document.types';
export const getDocumentRoute = authenticatedProcedure
.meta(getDocumentMeta)
.input(ZGetDocumentRequestSchema)
.output(ZGetDocumentResponseSchema)
.query(async ({ input, ctx }) => {
const { teamId, user } = ctx;
const { documentId } = input;
ctx.logger.info({
input: {
documentId,
},
});
return await getDocumentWithDetailsById({
userId: user.id,
teamId,
id: {
type: 'documentId',
id: documentId,
},
});
});