- Added city, state, and country optional fields to Complex model - Updated onboarding to include optional location fields - Created new settings page with sidebar navigation (Datos del Complejo, Canchas) - Replaced ESLint with Biome for frontend and backend linting - Added parallel dev script with concurrently - Migrated register-routes to use direct app.route() pattern
34 lines
1.4 KiB
TypeScript
34 lines
1.4 KiB
TypeScript
import { requireAuth } from '@/middlewares/require-auth.middleware';
|
|
import { createComplexHandler } from '@/modules/complex/handlers/create-complex.handler';
|
|
import { getComplexByIdHandler } from '@/modules/complex/handlers/get-complex-by-id.handler';
|
|
import { getComplexBySlugHandler } from '@/modules/complex/handlers/get-complex-by-slug.handler';
|
|
import { listMyComplexesHandler } from '@/modules/complex/handlers/list-my-complexes.handler';
|
|
import { updateComplexHandler } from '@/modules/complex/handlers/update-complex.handler';
|
|
import type { AppEnv } from '@/types/hono';
|
|
import { zValidator } from '@hono/zod-validator';
|
|
import { createComplexSchema, updateComplexSchema } from '@repo/api-contract';
|
|
import { Hono } from 'hono';
|
|
import { z } from 'zod';
|
|
|
|
export const complexRoutes = new Hono<AppEnv>();
|
|
const complexIdParamsSchema = z.object({ id: z.uuid() });
|
|
const complexSlugParamsSchema = z.object({ slug: z.string().trim().min(1) });
|
|
|
|
complexRoutes.use('*', requireAuth);
|
|
|
|
complexRoutes.post('/', zValidator('json', createComplexSchema), createComplexHandler);
|
|
complexRoutes.get('/mine', listMyComplexesHandler);
|
|
complexRoutes.get(
|
|
'/slug/:slug',
|
|
zValidator('param', complexSlugParamsSchema),
|
|
getComplexBySlugHandler
|
|
);
|
|
|
|
complexRoutes.get('/:id', zValidator('param', complexIdParamsSchema), getComplexByIdHandler);
|
|
complexRoutes.patch(
|
|
'/:id',
|
|
zValidator('param', complexIdParamsSchema),
|
|
zValidator('json', updateComplexSchema),
|
|
updateComplexHandler
|
|
);
|