({
inviteId,
role,
accountId,
}: {
inviteId: string;
role: Roles;
accountId: string;
})
| 194 | } |
| 195 | |
| 196 | export async function updateInvitation({ |
| 197 | inviteId, |
| 198 | role, |
| 199 | accountId, |
| 200 | }: { |
| 201 | inviteId: string; |
| 202 | role: Roles; |
| 203 | accountId: string; |
| 204 | }) { |
| 205 | const invite = await prisma.invites.findUnique({ where: { id: inviteId } }); |
| 206 | if (!invite) { |
| 207 | return { status: 404 }; |
| 208 | } |
| 209 | if (!invite?.accountsId) { |
| 210 | return { status: 403 }; |
| 211 | } |
| 212 | if (invite?.accountsId !== accountId) { |
| 213 | return { status: 403 }; |
| 214 | } |
| 215 | |
| 216 | await prisma.invites.update({ |
| 217 | where: { |
| 218 | id: inviteId, |
| 219 | }, |
| 220 | data: { |
| 221 | role, |
| 222 | }, |
| 223 | }); |
| 224 | |
| 225 | return { status: 200, message: 'invitation updated' }; |
| 226 | } |
| 227 | |
| 228 | export async function findInvitesByEmail( |
| 229 | email: string, |
no test coverage detected