import { FastifyInstance } from 'fastify';
import { clockIn, clockOut, getMyLogs } from '../controllers/timeclock.controller';

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

    server.post('/clock-in', clockIn);
    server.post('/clock-out', clockOut);
    server.get('/logs', getMyLogs);
}
