mirror of
https://github.com/documenso/documenso.git
synced 2026-07-26 01:45:08 +10:00
fix: refactor document router (#1990)
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
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,
|
||||
documentId,
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user