Files
taskview-community/api/src/tv-modules/graph/GraphRoutes.ts
T
2026-08-24 14:21:46 +02:00

29 lines
1.1 KiB
TypeScript

import { Router } from 'express';
import type { Routable } from '../../types/routable.type';
import { IsLoggedIn } from '../auth/middlewares/is-logged-in';
import { GraphController } from './GraphControler';
import { CanManageGraph } from './middlewares/CanManageGraph';
import { CanViewGraph } from './middlewares/CanViewGraph';
export default class GraphRoutes implements Routable {
private readonly router: ReturnType<typeof Router>;
private readonly graphController: GraphController;
constructor() {
this.router = Router();
this.graphController = new GraphController();
this.initRoutes();
}
getRouter() {
return this.router;
}
initRoutes() {
this.router.post('', [IsLoggedIn, CanManageGraph], this.graphController.addEdge);
this.router.get('/task/:taskId', [IsLoggedIn, CanViewGraph], this.graphController.fetchTaskEdges);
this.router.get('/:goalId', [IsLoggedIn, CanViewGraph], this.graphController.fetchAllEdges);
this.router.delete('/:id', [IsLoggedIn, CanManageGraph], this.graphController.deleteEdge);
}
}