budibase/packages/server/src/api/routes/application.js

21 lines
851 B
JavaScript
Raw Normal View History

2020-05-07 11:53:34 +02:00
const Router = require("@koa/router")
const controller = require("../controllers/application")
2020-05-21 15:31:23 +02:00
const authorized = require("../../middleware/authorized")
const { BUILDER, PermissionTypes, PermissionLevels } = require("@budibase/auth/permissions")
2020-04-07 18:25:09 +02:00
2020-05-07 11:53:34 +02:00
const router = Router()
2020-04-07 18:25:09 +02:00
router
.get("/api/applications/:appId/definition", controller.fetchAppDefinition)
.get("/api/applications", authorized(PermissionTypes.APP, PermissionLevels.READ), controller.fetch)
2020-05-21 15:31:23 +02:00
.get(
"/api/applications/:appId/appPackage",
authorized(PermissionTypes.APP, PermissionLevels.READ),
2020-05-21 15:31:23 +02:00
controller.fetchAppPackage
)
.put("/api/applications/:appId", authorized(BUILDER), controller.update)
2020-05-21 15:31:23 +02:00
.post("/api/applications", authorized(BUILDER), controller.create)
.delete("/api/applications/:appId", authorized(BUILDER), controller.delete)
2020-04-07 18:25:09 +02:00
2020-05-07 11:53:34 +02:00
module.exports = router