This commit is contained in:
2025-12-25 23:49:47 -07:00
parent 13821cbcd5
commit 0d608cf3f4
26 changed files with 7 additions and 94 deletions

View File

@@ -9,7 +9,6 @@ export const POST: APIRoute = async ({ request, locals, redirect }) => {
return new Response('Unauthorized', { status: 401 });
}
// Check if user is admin
const userMembership = await db.select()
.from(members)
.where(eq(members.userId, user.id))
@@ -31,7 +30,6 @@ export const POST: APIRoute = async ({ request, locals, redirect }) => {
return new Response('Invalid role', { status: 400 });
}
// Find user by email
const invitedUser = await db.select()
.from(users)
.where(eq(users.email, email))
@@ -41,7 +39,6 @@ export const POST: APIRoute = async ({ request, locals, redirect }) => {
return new Response('User not found. They must create an account first.', { status: 404 });
}
// Check if already a member
const existingMember = await db.select()
.from(members)
.where(and(
@@ -54,7 +51,6 @@ export const POST: APIRoute = async ({ request, locals, redirect }) => {
return new Response('User is already a member', { status: 400 });
}
// Add to organization
await db.insert(members).values({
userId: invitedUser.id,
organizationId: userMembership.organizationId,