Function
upsertUserRequest
({
id,
projectId,
instruction,
cliPreference,
}: UpsertUserRequestOptions)
Source from the content-addressed store, hash-verified
| 56 | * Uses the client-provided requestId as the primary key. |
| 57 | */ |
| 58 | export async function upsertUserRequest({ |
| 59 | id, |
| 60 | projectId, |
| 61 | instruction, |
| 62 | cliPreference, |
| 63 | }: UpsertUserRequestOptions) { |
| 64 | return prisma.userRequest.upsert({ |
| 65 | where: { id }, |
| 66 | create: { |
| 67 | id, |
| 68 | projectId, |
| 69 | instruction, |
| 70 | status: 'pending', |
| 71 | ...(cliPreference !== undefined ? { cliPreference } : {}), |
| 72 | }, |
| 73 | update: { |
| 74 | instruction, |
| 75 | ...(cliPreference !== undefined ? { cliPreference } : {}), |
| 76 | }, |
| 77 | }); |
| 78 | } |
| 79 | |
| 80 | async function updateStatus( |
| 81 | id: string, |
Tested by
no test coverage detected