1.0.0
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user