mirror of
https://github.com/documenso/documenso.git
synced 2025-11-10 04:22:32 +10:00
Add ability to enable or disable allowed signature types: - Drawn - Typed - Uploaded **Tabbed style signature dialog**  **Document settings**  **Team preferences**  ## Changes Made - Add multiselect to select allowed signatures in document and templates settings tab - Add multiselect to select allowed signatures in teams preferences - Removed "Enable typed signatures" from document/template edit page - Refactored signature pad to use tabs instead of an all in one signature pad ## Testing Performed Added E2E tests to check settings are applied correctly for documents and templates
53 lines
1.6 KiB
TypeScript
53 lines
1.6 KiB
TypeScript
import { upsertDocumentMeta } from '@documenso/lib/server-only/document-meta/upsert-document-meta';
|
|
import { updateDocument } from '@documenso/lib/server-only/document/update-document';
|
|
|
|
import { authenticatedProcedure } from '../trpc';
|
|
import {
|
|
ZUpdateDocumentRequestSchema,
|
|
ZUpdateDocumentResponseSchema,
|
|
} from './update-document.types';
|
|
import { updateDocumentMeta } from './update-document.types';
|
|
|
|
/**
|
|
* Public route.
|
|
*/
|
|
export const updateDocumentRoute = authenticatedProcedure
|
|
.meta(updateDocumentMeta)
|
|
.input(ZUpdateDocumentRequestSchema)
|
|
.output(ZUpdateDocumentResponseSchema)
|
|
.mutation(async ({ input, ctx }) => {
|
|
const { teamId } = ctx;
|
|
const { documentId, data, meta = {} } = input;
|
|
|
|
const userId = ctx.user.id;
|
|
|
|
if (Object.values(meta).length > 0) {
|
|
await upsertDocumentMeta({
|
|
userId: ctx.user.id,
|
|
teamId,
|
|
documentId,
|
|
subject: meta.subject,
|
|
message: meta.message,
|
|
timezone: meta.timezone,
|
|
dateFormat: meta.dateFormat,
|
|
language: meta.language,
|
|
typedSignatureEnabled: meta.typedSignatureEnabled,
|
|
uploadSignatureEnabled: meta.uploadSignatureEnabled,
|
|
drawSignatureEnabled: meta.drawSignatureEnabled,
|
|
redirectUrl: meta.redirectUrl,
|
|
distributionMethod: meta.distributionMethod,
|
|
signingOrder: meta.signingOrder,
|
|
emailSettings: meta.emailSettings,
|
|
requestMetadata: ctx.metadata,
|
|
});
|
|
}
|
|
|
|
return await updateDocument({
|
|
userId,
|
|
teamId,
|
|
documentId,
|
|
data,
|
|
requestMetadata: ctx.metadata,
|
|
});
|
|
});
|