feat: add envelopes api

This commit is contained in:
David Nguyen
2025-10-28 12:13:26 +11:00
parent e13b9f7c84
commit f6bdb34b56
50 changed files with 1002 additions and 701 deletions

View File

@ -0,0 +1,36 @@
import { getFieldById } from '@documenso/lib/server-only/field/get-field-by-id';
import { authenticatedProcedure } from '../../trpc';
import {
ZGetEnvelopeFieldRequestSchema,
ZGetEnvelopeFieldResponseSchema,
} from './get-envelope-field.types';
export const getEnvelopeFieldRoute = authenticatedProcedure
.meta({
openapi: {
method: 'GET',
path: '/envelope/field/{fieldId}',
summary: 'Get envelope field',
description: 'Returns an envelope field given an ID',
tags: ['Envelope Field'],
},
})
.input(ZGetEnvelopeFieldRequestSchema)
.output(ZGetEnvelopeFieldResponseSchema)
.query(async ({ input, ctx }) => {
const { teamId, user } = ctx;
const { fieldId } = input;
ctx.logger.info({
input: {
fieldId,
},
});
return await getFieldById({
userId: user.id,
teamId,
fieldId,
});
});