import { Router } from 'express'; import * as contractCategoryController from '../controllers/contractCategory.controller.js'; import { authenticate, requirePermission } from '../middleware/auth.js'; const router = Router(); // Lesen für alle authentifizierten Benutzer router.get('/', authenticate, contractCategoryController.getContractCategories); router.get('/:id', authenticate, contractCategoryController.getContractCategory); // Ändern/Löschen: `contract-categories:*` – wird per seed.ts an Admin- // Rollen vergeben. Vorher stand hier `developer:access` mit dem // Kommentar „Vertragstypen erfordern Formular-Anpassungen". Historische // Design-Restriktion, die aber im Widerspruch zum Permission-Seed stand // (Admin hatte `contract-categories:*` ohne Nutzen). Pentester R111 hat // die Diskrepanz aufgedeckt; angeglichen an die sechs Peer-Endpunkte // (platforms/tariffs/cancellation-periods/… nutzen alle ressourcen- // spezifische Perms statt developer:access). router.post('/', authenticate, requirePermission('contract-categories:create'), contractCategoryController.createContractCategory); router.put('/:id', authenticate, requirePermission('contract-categories:update'), contractCategoryController.updateContractCategory); router.delete('/:id', authenticate, requirePermission('contract-categories:delete'), contractCategoryController.deleteContractCategory); export default router;