mirror of
https://gitlab.massbug.com/massbug/judge4c.git
synced 2025-07-04 09:22:13 +00:00
feat(workspaces): refactor workspace routes to separate GET and POST handlers
This commit is contained in:
parent
377b37fe03
commit
af74979e09
@ -5,7 +5,18 @@ import { createWorkspaceSchema } from "../schemas";
|
||||
import { sessionMiddleware } from "@/lib/session-middleware";
|
||||
import { DATABASE_ID, IMAGES_BUCKET_ID, WORKSPACES_ID } from "@/config";
|
||||
|
||||
const app = new Hono().post(
|
||||
const app = new Hono()
|
||||
.get("/", sessionMiddleware, async (c) => {
|
||||
const databases = c.get("databases");
|
||||
|
||||
const workspaces = await databases.listDocuments(
|
||||
DATABASE_ID,
|
||||
WORKSPACES_ID
|
||||
);
|
||||
|
||||
return c.json({ data: workspaces });
|
||||
})
|
||||
.post(
|
||||
"/",
|
||||
zValidator("form", createWorkspaceSchema),
|
||||
sessionMiddleware,
|
||||
|
Loading…
Reference in New Issue
Block a user