feat: add OpenAPI support and in-process cron scheduler
- Install @elysia/openapi to auto-generate API docs at /api/openapi - Install @elysia/cron for in-process scheduled jobs (orphan detection at 2am, storage cleanup at 3am) - Add Scalar UI docs with 14 tag groups and Bearer JWT security scheme - Add route-level detail annotations (tags, summaries) to all 30+ route files - Upgrade crud-builder to accept optional tags config - Keep HTTP cron endpoint as manual/admin fallback
This commit is contained in:
+2
-2
@@ -15,7 +15,7 @@ interface CronTaskResult {
|
||||
// ── Task Registry ───────────────────────────────────────────────────
|
||||
type CronTask = () => Promise<CronTaskResult>
|
||||
|
||||
const taskRegistry = new Map<string, CronTask>()
|
||||
export const taskRegistry = new Map<string, CronTask>()
|
||||
|
||||
export function registerCronTask(name: string, task: CronTask): void {
|
||||
taskRegistry.set(name, task)
|
||||
@@ -111,7 +111,7 @@ registerCronTask("orphan_detection", async () => {
|
||||
})
|
||||
|
||||
// ── Cron Route ──────────────────────────────────────────────────────
|
||||
export const cronRoutes = new Elysia({ prefix: "/cron" }).post(
|
||||
export const cronRoutes = new Elysia({ prefix: "/cron", detail: { tags: ["Cron"] } }).post(
|
||||
"/daily",
|
||||
async ({ query, set }) => {
|
||||
const cronSecret = process.env.CRON_SECRET
|
||||
|
||||
Reference in New Issue
Block a user