27 lines
788 B
TypeScript
27 lines
788 B
TypeScript
/**
|
|
* @ai-summary Donations HTTP routes
|
|
* @ai-context Defines donation endpoints with authentication
|
|
*/
|
|
|
|
import { FastifyInstance, FastifyPluginAsync, FastifyPluginOptions } from 'fastify';
|
|
import { DonationsController } from './donations.controller';
|
|
|
|
export const donationsRoutes: FastifyPluginAsync = async (
|
|
fastify: FastifyInstance,
|
|
_opts: FastifyPluginOptions
|
|
) => {
|
|
const controller = new DonationsController();
|
|
|
|
// POST /api/donations - Create donation
|
|
fastify.post('/donations', {
|
|
preHandler: [fastify.authenticate],
|
|
handler: controller.createDonation.bind(controller),
|
|
});
|
|
|
|
// GET /api/donations - Get donation history
|
|
fastify.get('/donations', {
|
|
preHandler: [fastify.authenticate],
|
|
handler: controller.getDonations.bind(controller),
|
|
});
|
|
};
|