mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 08:13:56 +10:00
chore: add more field types (#1141)
Adds a number of new field types and capabilities to existing fields. A massive change with far too many moving pieces to document in a single commit.
This commit is contained in:
@ -23,6 +23,10 @@ export const mapField = (
|
||||
.with(FieldType.EMAIL, () => signer.email)
|
||||
.with(FieldType.NAME, () => signer.name)
|
||||
.with(FieldType.TEXT, () => signer.customText)
|
||||
.with(FieldType.NUMBER, () => signer.customText)
|
||||
.with(FieldType.RADIO, () => signer.customText)
|
||||
.with(FieldType.CHECKBOX, () => signer.customText)
|
||||
.with(FieldType.DROPDOWN, () => signer.customText)
|
||||
.otherwise(() => '');
|
||||
|
||||
return {
|
||||
|
||||
@ -31,7 +31,7 @@ export const singleplayerRouter = router({
|
||||
.input(ZCreateSinglePlayerDocumentMutationSchema)
|
||||
.mutation(async ({ input }) => {
|
||||
try {
|
||||
const { signer, fields, documentData, documentName } = input;
|
||||
const { signer, fields, documentData, documentName, fieldMeta } = input;
|
||||
|
||||
const document = await getFile({
|
||||
data: documentData.data,
|
||||
@ -69,6 +69,7 @@ export const singleplayerRouter = router({
|
||||
documentId: -1,
|
||||
templateId: null,
|
||||
recipientId: -1,
|
||||
fieldMeta: fieldMeta || null,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
import { ZFieldMetaSchema } from '@documenso/lib/types/field-meta';
|
||||
import { DocumentDataType, FieldType } from '@documenso/prisma/client';
|
||||
|
||||
export const ZCreateSinglePlayerDocumentMutationSchema = z.object({
|
||||
@ -24,6 +25,7 @@ export const ZCreateSinglePlayerDocumentMutationSchema = z.object({
|
||||
height: z.number(),
|
||||
}),
|
||||
),
|
||||
fieldMeta: ZFieldMetaSchema,
|
||||
});
|
||||
|
||||
export type TCreateSinglePlayerDocumentMutationSchema = z.infer<
|
||||
|
||||
Reference in New Issue
Block a user