diff --git a/backend/src/routes/branding.routes.ts b/backend/src/routes/branding.routes.ts index 1ef3b1c..579c24e 100644 --- a/backend/src/routes/branding.routes.ts +++ b/backend/src/routes/branding.routes.ts @@ -20,7 +20,7 @@ const brandingSchema = z.object({ export async function brandingRoutes(fastify: FastifyInstance) { // Get all branding configurations - fastify.get('/api/branding', async (request, reply) => { + fastify.get('/', async (request, reply) => { try { const brandings = brandingService.listBrandings(); reply.send({ brandings }); @@ -30,7 +30,7 @@ export async function brandingRoutes(fastify: FastifyInstance) { }); // Get a specific branding configuration - fastify.get<{ Params: { id: string } }>('/api/branding/:id', async (request, reply) => { + fastify.get<{ Params: { id: string } }>('/:id', async (request, reply) => { try { const { id } = request.params; const branding = brandingService.getBranding(id); @@ -46,7 +46,7 @@ export async function brandingRoutes(fastify: FastifyInstance) { }); // Create or update branding - fastify.post<{ Params: { id?: string } }>('/api/branding/:id?', async (request, reply) => { + fastify.post<{ Params: { id?: string } }>('/:id?', async (request, reply) => { try { const { id } = request.params; const body = brandingSchema.parse(request.body); @@ -66,7 +66,7 @@ export async function brandingRoutes(fastify: FastifyInstance) { }); // Delete branding - fastify.delete<{ Params: { id: string } }>('/api/branding/:id', async (request, reply) => { + fastify.delete<{ Params: { id: string } }>('/:id', async (request, reply) => { try { const { id } = request.params; @@ -83,7 +83,7 @@ export async function brandingRoutes(fastify: FastifyInstance) { }); // Get default branding - fastify.get('/api/branding/default', async (request, reply) => { + fastify.get('/default', async (request, reply) => { try { const branding = brandingService.getDefaultBranding(); reply.send(branding); diff --git a/backend/src/routes/pdf.routes.ts b/backend/src/routes/pdf.routes.ts index aabd6a7..c95756c 100644 --- a/backend/src/routes/pdf.routes.ts +++ b/backend/src/routes/pdf.routes.ts @@ -38,7 +38,7 @@ const labelSchema = z.object({ export async function pdfRoutes(fastify: FastifyInstance) { // Register a custom font for PDF generation - fastify.post('/api/pdf/fonts/register', async (request, reply) => { + fastify.post('/fonts/register', async (request, reply) => { try { const data = request.body as { name: string; fontData: string }; // base64 encoded font data @@ -66,7 +66,7 @@ export async function pdfRoutes(fastify: FastifyInstance) { }); // List registered fonts - fastify.get('/api/pdf/fonts', async (request, reply) => { + fastify.get('/fonts', async (request, reply) => { try { const fonts = pdfService.getRegisteredFonts(); reply.send({ fonts }); @@ -76,7 +76,7 @@ export async function pdfRoutes(fastify: FastifyInstance) { }); // Generate a simple text PDF - fastify.post('/api/pdf/text', async (request, reply) => { + fastify.post('/text', async (request, reply) => { try { const body = textPDFSchema.parse(request.body) const pdf = pdfService.generateTextPDF(body.content, body.options || { width: 612, height: 792, margin: 72 }) @@ -91,7 +91,7 @@ export async function pdfRoutes(fastify: FastifyInstance) { }) // Generate a certificate PDF - fastify.post('/api/pdf/certificate', async (request, reply) => { + fastify.post('/certificate', async (request, reply) => { try { const body = certificateSchema.parse(request.body) const pdf = pdfService.generateCertificate(body) @@ -106,7 +106,7 @@ export async function pdfRoutes(fastify: FastifyInstance) { }) // Generate a label PDF - fastify.post('/api/pdf/label', async (request, reply) => { + fastify.post('/label', async (request, reply) => { try { const body = labelSchema.parse(request.body) const pdf = pdfService.generateLabel(body) @@ -121,7 +121,7 @@ export async function pdfRoutes(fastify: FastifyInstance) { }) // Health check for PDF service - fastify.get('/api/pdf/health', async (request, reply) => { + fastify.get('/health', async (request, reply) => { reply.send({ status: 'ok', service: 'tinypdf-plus', diff --git a/backend/src/server.ts b/backend/src/server.ts index bebcfe8..93b5680 100644 --- a/backend/src/server.ts +++ b/backend/src/server.ts @@ -75,8 +75,8 @@ server.register(plantRoutes, { prefix: '/api/plants' }); // PDF generation import { pdfRoutes } from './routes/pdf.routes'; import { brandingRoutes } from './routes/branding.routes'; -server.register(pdfRoutes); -server.register(brandingRoutes); +server.register(pdfRoutes, { prefix: '/api/pdf' }); +server.register(brandingRoutes, { prefix: '/api/branding' }); // Phase 10: Compliance import { auditRoutes } from './routes/audit.routes';