mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 08:13:56 +10:00
feat: add get field endpoints (#1599)
This commit is contained in:
@ -47,15 +47,15 @@ export const fieldRouter = router({
|
|||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
getField: authenticatedProcedure
|
getDocumentField: authenticatedProcedure
|
||||||
.meta({
|
.meta({
|
||||||
openapi: {
|
openapi: {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
path: '/field/{fieldId}',
|
path: '/document/field/{fieldId}',
|
||||||
summary: 'Get field',
|
summary: 'Get document field',
|
||||||
description:
|
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.',
|
'Returns a single field. If you want to retrieve all the fields for a document, use the "Get Document" endpoint.',
|
||||||
tags: ['Document Fields', 'Template Fields'],
|
tags: ['Document Fields'],
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.input(ZGetFieldRequestSchema)
|
.input(ZGetFieldRequestSchema)
|
||||||
@ -273,6 +273,33 @@ export const fieldRouter = router({
|
|||||||
return createdFields.fields[0];
|
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
|
* @public
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -47,15 +47,15 @@ export const recipientRouter = router({
|
|||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
getRecipient: authenticatedProcedure
|
getDocumentRecipient: authenticatedProcedure
|
||||||
.meta({
|
.meta({
|
||||||
openapi: {
|
openapi: {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
path: '/recipient/{recipientId}',
|
path: '/document/recipient/{recipientId}',
|
||||||
summary: 'Get recipient',
|
summary: 'Get document recipient',
|
||||||
description:
|
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.',
|
'Returns a single recipient. If you want to retrieve all the recipients for a document, use the "Get Document" endpoint.',
|
||||||
tags: ['Document Recipients', 'Template Recipients'],
|
tags: ['Document Recipients'],
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.input(ZGetRecipientRequestSchema)
|
.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
|
* @public
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user