2020-05-20 18:02:46 +02:00
|
|
|
const Router = require("@koa/router")
|
|
|
|
const controller = require("../controllers/workflow")
|
2020-05-27 18:23:01 +02:00
|
|
|
const authorized = require("../../middleware/authorized")
|
2020-06-01 22:26:32 +02:00
|
|
|
const { BUILDER } = require("../../utilities/accessLevels")
|
2020-05-20 18:02:46 +02:00
|
|
|
|
|
|
|
const router = Router()
|
|
|
|
|
|
|
|
router
|
2020-06-18 17:59:31 +02:00
|
|
|
.get("/api/workflows", authorized(BUILDER), controller.fetch)
|
2020-06-01 22:26:32 +02:00
|
|
|
.get("/api/workflows/:id", authorized(BUILDER), controller.find)
|
2020-05-27 18:23:01 +02:00
|
|
|
.get(
|
2020-06-18 17:59:31 +02:00
|
|
|
"/api/workflows/:id/:action",
|
2020-05-27 18:23:01 +02:00
|
|
|
authorized(BUILDER),
|
|
|
|
controller.fetchActionScript
|
|
|
|
)
|
2020-06-18 17:59:31 +02:00
|
|
|
.put("/api/workflows", authorized(BUILDER), controller.update)
|
|
|
|
.post("/api/workflows", authorized(BUILDER), controller.create)
|
2020-06-02 12:08:53 +02:00
|
|
|
.post("/api/workflows/action", controller.executeAction)
|
2020-06-18 17:59:31 +02:00
|
|
|
.delete("/api/workflows/:id/:rev", authorized(BUILDER), controller.destroy)
|
2020-05-20 18:02:46 +02:00
|
|
|
|
|
|
|
module.exports = router
|