sandbox data route + cosmetic changes

This commit is contained in:
Ishaan Dey
2024-04-27 00:28:00 -04:00
parent 39696128db
commit 1b6bd01989
5 changed files with 42 additions and 8 deletions

View File

@ -46,8 +46,18 @@ export default {
});
return success;
// } else if (path === "/api/sandbox/files") {
} else if (path === "/api/sandbox" && method === "GET") {
const params = url.searchParams;
if (params.has("id")) {
const id = params.get("id") as string;
const res = await db.query.sandbox.findFirst({
where: (sandbox, { eq }) => eq(sandbox.id, id),
});
return json(res ?? {});
} else {
const res = await db.select().from(sandbox).all();
return json(res ?? {});
}
} else if (path === "/api/user") {
if (method === "GET") {
const params = url.searchParams;