© 2026 Hedgehog Software, LLC
export async function createInterview(data: { participantIdentifier?: string; protocolId: string; }) { const { participantIdentifier, protocolId } = data; const createdInterview = await prisma.interview.create({ select: { participant: true, id: true, }, data: { network: Prisma.JsonNull, participant: { connectOrCreate: { create: { identifier: participantIdentifier!, }, where: { identifier: participantIdentifier, }, }, }, protocol: { connect: { id: protocolId, }, }, }, }); return { error: null, createdInterviewId: createdInterview.id, errorType: null, }; }
"It should connect a participant if an existing identifier is provided or create a participant if an identifier doesn't exist in the db'"