| import { Request, Response, Router, RequestHandler } from "express"; |
| import { |
| submitCode, |
| loginWithSession, |
| getActiveClients, |
| requestCode, |
| addTelegrafBot, |
| createTask, |
| cancelTask, |
| getActiveTasks, |
| sendMessage, |
| startBotsEndpoint, |
| stopBotsEndpoint, |
| restartBotsEndpoint, |
| getBotsStateEndpoint, |
| getCommands, |
| getCommand, |
| createCommand, |
| updateCommand, |
| deleteCommand, |
| getMessages, |
| getMessage, |
| createMessage, |
| updateMessage, |
| deleteMessage, |
| startTelegrafBotsEndpoint, |
| startSpecificBotEndpoint, |
| stopSpecificBotEndpoint |
| |
| } from "./controllers"; |
|
|
| export const setupRoutes = (app: any) => { |
| const router = Router(); |
|
|
| router.post("/submit-code", submitCode as unknown as RequestHandler); |
| router.post("/login-with-session", loginWithSession as unknown as RequestHandler); |
| router.get("/active-clients", getActiveClients as unknown as RequestHandler); |
| router.post("/request-code", requestCode as unknown as RequestHandler); |
| router.post("/add-telegraf-bot", addTelegrafBot as unknown as RequestHandler); |
| router.post("/create-task", createTask as unknown as RequestHandler); |
| router.delete("/cancel-task/:taskId", cancelTask as unknown as RequestHandler); |
| router.get("/active-tasks", getActiveTasks as unknown as RequestHandler); |
| router.post("/send-message", sendMessage as unknown as RequestHandler); |
|
|
| router.post("/bots/start", startBotsEndpoint as unknown as RequestHandler); |
| router.post("/bots/stop", stopBotsEndpoint as unknown as RequestHandler); |
| router.post("/bots/restart", restartBotsEndpoint as unknown as RequestHandler); |
| router.post("/bots/telegraf/start", startTelegrafBotsEndpoint as unknown as RequestHandler); |
| router.post("/bots/telegraf/start-specific", startSpecificBotEndpoint as unknown as RequestHandler); |
| router.post("/bots/telegraf/stop-specific", stopSpecificBotEndpoint as unknown as RequestHandler); |
|
|
| router.get("/bots/state", getBotsStateEndpoint as unknown as RequestHandler); |
|
|
| |
| router.get('/api/commands', getCommands as unknown as RequestHandler); |
| router.get('/api/commands/:id', getCommand as unknown as RequestHandler); |
| router.post('/api/commands', createCommand as unknown as RequestHandler); |
| router.put('/api/commands/:id', updateCommand as unknown as RequestHandler); |
| router.delete('/api/commands/:id', deleteCommand as unknown as RequestHandler); |
|
|
| |
| router.get('/api/messages', getMessages as unknown as RequestHandler); |
| router.get('/api/messages/:id', getMessage as unknown as RequestHandler); |
| router.post('/api/messages', createMessage as unknown as RequestHandler); |
| router.put('/api/messages/:id', updateMessage as unknown as RequestHandler); |
| router.delete('/api/messages/:id', deleteMessage as unknown as RequestHandler); |
|
|
| app.use("/", router); |
| }; |