add + remove users from organisation

This commit is contained in:
Oliver Bryan
2026-01-01 10:46:54 +00:00
parent 8511c6472c
commit 63fef4a0e9
20 changed files with 560 additions and 32 deletions

View File

@@ -0,0 +1,19 @@
import type { BunRequest } from "bun";
import { getUserByUsername } from "../../db/queries";
// /user/by-username?username=someusername
export default async function userByUsername(req: BunRequest) {
const url = new URL(req.url);
const username = url.searchParams.get("username");
if (!username) {
return new Response("username is required", { status: 400 });
}
const user = await getUserByUsername(username);
if (!user) {
return new Response(`User with username '${username}' not found`, { status: 404 });
}
return Response.json(user);
}