2020-12-02 14:20:56 +01:00
|
|
|
const Router = require("@koa/router")
|
|
|
|
const controller = require("../controllers/role")
|
|
|
|
const authorized = require("../../middleware/authorized")
|
2022-02-24 12:39:38 +01:00
|
|
|
const { BUILDER } = require("@budibase/backend-core/permissions")
|
|
|
|
const { roleValidator } = require("./utils/validators")
|
2020-12-02 14:20:56 +01:00
|
|
|
|
|
|
|
const router = Router()
|
|
|
|
|
|
|
|
router
|
2022-02-24 12:39:38 +01:00
|
|
|
.post("/api/roles", authorized(BUILDER), roleValidator(), controller.save)
|
2020-12-02 14:20:56 +01:00
|
|
|
.get("/api/roles", authorized(BUILDER), controller.fetch)
|
|
|
|
.get("/api/roles/:roleId", authorized(BUILDER), controller.find)
|
|
|
|
.delete("/api/roles/:roleId/:rev", authorized(BUILDER), controller.destroy)
|
|
|
|
|
|
|
|
module.exports = router
|