mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-03-31 22:32:28 +00:00
49 lines
1.1 KiB
TypeScript
49 lines
1.1 KiB
TypeScript
import { Hono } from "hono"
|
|
import { describeRoute } from "hono-openapi"
|
|
import { resolver } from "hono-openapi"
|
|
import { Instance } from "../project/instance"
|
|
import { Project } from "../project/project"
|
|
|
|
export const ProjectRoute = new Hono()
|
|
.get(
|
|
"/",
|
|
describeRoute({
|
|
description: "List all projects",
|
|
operationId: "project.list",
|
|
responses: {
|
|
200: {
|
|
description: "List of projects",
|
|
content: {
|
|
"application/json": {
|
|
schema: resolver(Project.Info.array()),
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}),
|
|
async (c) => {
|
|
const projects = await Project.list()
|
|
return c.json(projects)
|
|
},
|
|
)
|
|
.get(
|
|
"/current",
|
|
describeRoute({
|
|
description: "Get the current project",
|
|
operationId: "project.current",
|
|
responses: {
|
|
200: {
|
|
description: "Current project",
|
|
content: {
|
|
"application/json": {
|
|
schema: resolver(Project.Info),
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}),
|
|
async (c) => {
|
|
return c.json(Instance.project)
|
|
},
|
|
)
|