mirror of
https://github.com/documenso/documenso.git
synced 2026-07-13 22:37:24 +10:00
7ea664214a
## Description Add envelopes V2 embedded support --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
41 lines
810 B
TypeScript
41 lines
810 B
TypeScript
import { prisma } from '@documenso/prisma';
|
|
|
|
type UnsafeUpdateEnvelopeItemsOptions = {
|
|
envelopeId: string;
|
|
data: {
|
|
envelopeItemId: string;
|
|
order?: number;
|
|
title?: string;
|
|
}[];
|
|
};
|
|
|
|
export const UNSAFE_updateEnvelopeItems = async ({
|
|
envelopeId,
|
|
data,
|
|
}: UnsafeUpdateEnvelopeItemsOptions) => {
|
|
// Todo: Envelope [AUDIT_LOGS]
|
|
|
|
const updatedEnvelopeItems = await Promise.all(
|
|
data.map(async ({ envelopeItemId, order, title }) =>
|
|
prisma.envelopeItem.update({
|
|
where: {
|
|
envelopeId,
|
|
id: envelopeItemId,
|
|
},
|
|
data: {
|
|
order,
|
|
title,
|
|
},
|
|
select: {
|
|
id: true,
|
|
order: true,
|
|
title: true,
|
|
envelopeId: true,
|
|
},
|
|
}),
|
|
),
|
|
);
|
|
|
|
return updatedEnvelopeItems;
|
|
};
|