| 1 | import { createRoute, z } from '@hono/zod-openapi' |
| 2 | import { eq, getTableColumns |
| 3 | import type { app |
| 4 | import { requireApiKey } |
| 5 | import { ProjectEntity } |
| 6 | import { errorResponse } |
| 7 | import { db } |
| 8 | import { projects } |
| 9 | |
| 10 | const route = createRoute |
| 11 | method: 'get', |
| 12 | path: '/projects', |
| 13 | responses: { |
| 14 | 401: { ...errorResponse |
| 15 | 402: { |
| 16 | ...errorResponse, |
| 17 | description: 'Organization is not on the Pro plan', |
| 18 | }, |
| 19 | 403: { ...errorResponse |
| 20 | 429: { ...errorResponse |
| 21 | 200: { |
| 22 | description: 'Organization projects', |
| 23 | content: { |
| 24 | 'application/json': { |
| 25 | schema: z.array |
| 26 | }, |
| 27 | }, |
| 28 | }, |
| 29 | }, |
| 30 | description: 'Get list of projects', |
| 31 | summary: 'Get list of projects', |
| 32 | tags: ['Projects'], |
| 33 | }) |
| 34 | |
| 35 | export const handler = |
| 36 | hono.openapi(route |
| 37 | const key = |
| 38 | const { organizationId, |
| 39 | const orgProjects = |
| 40 | .select({ ... |
| 41 | .from(projects) |
| 42 | .where(eq(projects |
| 43 | return c.json |
| 44 | }) |
| 45 | } |