MCPcopy Create free account
hub / github.com/Linen-dev/linen.dev / updateInvitation

Function updateInvitation

apps/web/services/invites.ts:196–226  ·  view source on GitHub ↗
({
  inviteId,
  role,
  accountId,
}: {
  inviteId: string;
  role: Roles;
  accountId: string;
})

Source from the content-addressed store, hash-verified

194}
195
196export 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
228export async function findInvitesByEmail(
229 email: string,

Callers 2

handlerFunction · 0.90
invites.test.tsFile · 0.90

Calls 1

updateMethod · 0.45

Tested by

no test coverage detected