feat: scope assistants to strictly later signing steps

This commit is contained in:
David Nguyen
2026-08-04 17:33:05 +10:00
parent 129833d6bb
commit 19514b182b
2 changed files with 13 additions and 6 deletions
@@ -23,9 +23,13 @@ export const getRecipientsForAssistant = async ({ token }: GetRecipientsForAssis
let recipients = await prisma.recipient.findMany({
where: {
envelopeId: assistant.envelopeId,
signingOrder: {
gte: assistant.signingOrder ?? 0,
},
OR: [
// The assistant themself — they may have fields of their own.
{ id: assistant.id },
// Grouped assistants only assist strictly later steps, never their
// own group peers.
{ signingOrder: { gt: assistant.signingOrder ?? 0 } },
],
},
include: {
fields: {