14 lines
556 B
TypeScript
14 lines
556 B
TypeScript
import { Hono } from "hono";
|
|
import type { SettingsService } from "@great-agent/agent-core";
|
|
import { updateSettingsRequestSchema } from "@great-agent/web-contracts";
|
|
|
|
export function createSettingsRoutes(service: SettingsService): Hono {
|
|
const routes = new Hono();
|
|
routes.get("/settings", async (context) => context.json(await service.get()));
|
|
routes.patch("/settings", async (context) => {
|
|
const input = updateSettingsRequestSchema.parse(await context.req.json());
|
|
return context.json(await service.update(input));
|
|
});
|
|
return routes;
|
|
}
|