import { defineRoute, response } from "@veducio/keja";
import { z } from "zod";
import { notes } from "../db/repositories.ts";
export default defineRoute({
method: "get",
path: "/notes",
version: "v1",
request: { query: notes.list.schema },
responses: {
Notes: response({
code: 200,
json: z.object({
notes: z.array(notes.meta),
nextCursor: z.string().nullable(),
}),
}),
},
handler: async ({ query, respond }) => {
const page = await notes.list(query, {
tenant: "tenant_01h455vb4pex5vsknk084sn02q",
});
return respond.Notes({
notes: page.items,
nextCursor: page.nextCursor,
});
},
});