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")
|
2021-05-27 15:53:41 +02:00
|
|
|
const { BUILDER } = require("@budibase/auth/permissions")
|
2021-09-23 23:40:14 +02:00
|
|
|
const usage = require("../../middleware/usageQuota")
|
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
|
|
|
|
2020-04-08 12:18:30 +02:00
|
|
|
router
|
2021-10-22 15:34:20 +02:00
|
|
|
.post("/api/applications/:appId/sync", authorized(BUILDER), controller.sync)
|
2021-09-23 23:40:14 +02:00
|
|
|
.post("/api/applications", authorized(BUILDER), usage, controller.create)
|
2020-11-19 17:55:59 +01:00
|
|
|
.get("/api/applications/:appId/definition", controller.fetchAppDefinition)
|
2021-05-27 15:53:41 +02:00
|
|
|
.get("/api/applications", controller.fetch)
|
2021-05-27 15:53:47 +02:00
|
|
|
.get("/api/applications/:appId/appPackage", controller.fetchAppPackage)
|
2020-11-19 17:55:59 +01:00
|
|
|
.put("/api/applications/:appId", authorized(BUILDER), controller.update)
|
2021-07-07 18:07:42 +02:00
|
|
|
.post(
|
|
|
|
"/api/applications/:appId/client/update",
|
|
|
|
authorized(BUILDER),
|
|
|
|
controller.updateClient
|
|
|
|
)
|
2021-07-08 13:56:54 +02:00
|
|
|
.post(
|
|
|
|
"/api/applications/:appId/client/revert",
|
|
|
|
authorized(BUILDER),
|
|
|
|
controller.revertClient
|
|
|
|
)
|
2021-09-24 00:25:25 +02:00
|
|
|
.delete(
|
|
|
|
"/api/applications/:appId",
|
|
|
|
authorized(BUILDER),
|
|
|
|
usage,
|
|
|
|
controller.delete
|
|
|
|
)
|
2020-04-07 18:25:09 +02:00
|
|
|
|
2020-05-07 11:53:34 +02:00
|
|
|
module.exports = router
|