diff --git a/packages/trpc/server/field-router/router.ts b/packages/trpc/server/field-router/router.ts index 04596000d..a05811675 100644 --- a/packages/trpc/server/field-router/router.ts +++ b/packages/trpc/server/field-router/router.ts @@ -47,15 +47,15 @@ export const fieldRouter = router({ /** * @public */ - getField: authenticatedProcedure + getDocumentField: authenticatedProcedure .meta({ openapi: { method: 'GET', - path: '/field/{fieldId}', - summary: 'Get field', + path: '/document/field/{fieldId}', + summary: 'Get document field', description: - 'Returns a single field. If you want to retrieve all the fields for a document or template, use the "Get Document" or "Get Template" request.', - tags: ['Document Fields', 'Template Fields'], + 'Returns a single field. If you want to retrieve all the fields for a document, use the "Get Document" endpoint.', + tags: ['Document Fields'], }, }) .input(ZGetFieldRequestSchema) @@ -273,6 +273,33 @@ export const fieldRouter = router({ return createdFields.fields[0]; }), + /** + * @public + */ + getTemplateField: authenticatedProcedure + .meta({ + openapi: { + method: 'GET', + path: '/template/field/{fieldId}', + summary: 'Get template field', + description: + 'Returns a single field. If you want to retrieve all the fields for a template, use the "Get Template" endpoint.', + tags: ['Template Fields'], + }, + }) + .input(ZGetFieldRequestSchema) + .output(ZGetFieldResponseSchema) + .query(async ({ input, ctx }) => { + const { teamId } = ctx; + const { fieldId } = input; + + return await getFieldById({ + userId: ctx.user.id, + teamId, + fieldId, + }); + }), + /** * @public */ diff --git a/packages/trpc/server/recipient-router/router.ts b/packages/trpc/server/recipient-router/router.ts index 4259a272f..f62660da8 100644 --- a/packages/trpc/server/recipient-router/router.ts +++ b/packages/trpc/server/recipient-router/router.ts @@ -47,15 +47,15 @@ export const recipientRouter = router({ /** * @public */ - getRecipient: authenticatedProcedure + getDocumentRecipient: authenticatedProcedure .meta({ openapi: { method: 'GET', - path: '/recipient/{recipientId}', - summary: 'Get recipient', + path: '/document/recipient/{recipientId}', + summary: 'Get document recipient', description: - 'Returns a single recipient. If you want to retrieve all the recipients for a document or template, use the "Get Document" or "Get Template" request.', - tags: ['Document Recipients', 'Template Recipients'], + 'Returns a single recipient. If you want to retrieve all the recipients for a document, use the "Get Document" endpoint.', + tags: ['Document Recipients'], }, }) .input(ZGetRecipientRequestSchema) @@ -239,6 +239,33 @@ export const recipientRouter = router({ }); }), + /** + * @public + */ + getTemplateRecipient: authenticatedProcedure + .meta({ + openapi: { + method: 'GET', + path: '/template/recipient/{recipientId}', + summary: 'Get template recipient', + description: + 'Returns a single recipient. If you want to retrieve all the recipients for a template, use the "Get Template" endpoint.', + tags: ['Template Recipients'], + }, + }) + .input(ZGetRecipientRequestSchema) + .output(ZGetRecipientResponseSchema) + .query(async ({ input, ctx }) => { + const { teamId } = ctx; + const { recipientId } = input; + + return await getRecipientById({ + userId: ctx.user.id, + teamId, + recipientId, + }); + }), + /** * @public */