import _ from 'lodash' import { Type, type Static, type FastifyPluginCallbackTypebox } from '@fastify/type-provider-typebox' import knex from '../../lib/knex.ts' const journalRoutes: FastifyPluginCallbackTypebox = (fastify, _, done) => { fastify.route({ url: '/', method: 'GET', async handler(req) { return knex('supplier').select('*').orderBy('name') }, }) fastify.route({ url: '/:id', method: 'GET', schema: { params: Type.Object({ id: Type.Number(), }), }, async handler(req) { return knex('supplier').first('*').where('id', req.params.id) }, }) done() } export default journalRoutes