feat: add users and templates routes, enhance existing API routes
New routes: - GET /users — list all users - GET/POST /templates — list and create templates - PATCH /templates/:id — update template - POST /templates/preview — render template with ticket/demo context Enhanced routes: - tickets: custom field support on create, status classification helper - custom-fields: PATCH endpoint, auto-generate short key from name - lifecycles: PATCH endpoint - queues: PATCH endpoint Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
17
src/routes/users.ts
Normal file
17
src/routes/users.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { Hono } from 'hono';
|
||||
import { asc } from 'drizzle-orm';
|
||||
import type { Db } from '../db/index.ts';
|
||||
import { users } from '../db/schema.ts';
|
||||
|
||||
export function createUsersRouter(db: Db): Hono {
|
||||
const router = new Hono();
|
||||
|
||||
router.get('/', async (c) => {
|
||||
const result = await db.query.users.findMany({
|
||||
orderBy: asc(users.username),
|
||||
});
|
||||
return c.json(result);
|
||||
});
|
||||
|
||||
return router;
|
||||
}
|
||||
Reference in New Issue
Block a user