35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
|
|
import { Router } from 'express';
|
||
|
|
import { ProtocolController } from '../controllers/ProtocolController';
|
||
|
|
import { GetAllProtocolsUseCase } from '../../../application/usecases/GetAllProtocolsUseCase';
|
||
|
|
import { GetProtocolByIdUseCase } from '../../../application/usecases/GetProtocolByIdUseCase';
|
||
|
|
import { StaticProtocolRepository } from '../../persistence/StaticProtocolRepository';
|
||
|
|
|
||
|
|
// manual dependency injection for routes
|
||
|
|
const repository = new StaticProtocolRepository();
|
||
|
|
const getAllUseCase = new GetAllProtocolsUseCase(repository);
|
||
|
|
const getByIdUseCase = new GetProtocolByIdUseCase(repository);
|
||
|
|
const controller = new ProtocolController(getAllUseCase, getByIdUseCase);
|
||
|
|
|
||
|
|
const router = Router();
|
||
|
|
|
||
|
|
router.get('/', controller.getAll);
|
||
|
|
router.get('/:id', controller.getById);
|
||
|
|
|
||
|
|
// Placeholders for future endpoints matching the original content.ts routes
|
||
|
|
router.post('/', (_req, res) => {
|
||
|
|
res.status(201).json({
|
||
|
|
message: 'Create content endpoint - to be implemented',
|
||
|
|
id: 'new-content-id'
|
||
|
|
});
|
||
|
|
});
|
||
|
|
|
||
|
|
router.put('/:id', (req, res) => {
|
||
|
|
res.json({ message: `Update content ${req.params.id} - to be implemented` });
|
||
|
|
});
|
||
|
|
|
||
|
|
router.delete('/:id', (req, res) => {
|
||
|
|
res.json({ message: `Delete content ${req.params.id} - to be implemented` });
|
||
|
|
});
|
||
|
|
|
||
|
|
export default router;
|