import { FastifyInstance } from 'fastify';
import { createWeightLog, getBatchWeights } from '../controllers/weight-logs.controller';

export async function weightLogsRoutes(server: FastifyInstance) {
    server.addHook('onRequest', async (request) => {
        try {
            await request.jwtVerify();
        } catch (err) {
            throw err;
        }
    });

    server.post('/:id/weights', createWeightLog);
    server.get('/:id/weights', getBatchWeights);
}
