1
0
Fork 0
mirror of synced 2024-06-20 19:30:28 +12:00
budibase/packages/server/src/api/routes/user.js

22 lines
734 B
JavaScript
Raw Normal View History

2020-05-07 21:53:34 +12:00
const Router = require("@koa/router")
const controller = require("../controllers/user")
2020-05-22 01:31:23 +12:00
const authorized = require("../../middleware/authorized")
const { USER_MANAGEMENT, LIST_USERS } = require("../../utilities/accessLevels")
const usage = require("../../middleware/usageQuota")
2020-05-07 21:53:34 +12:00
const router = Router()
2020-05-05 04:13:57 +12:00
router
2020-06-19 03:59:31 +12:00
.get("/api/users", authorized(LIST_USERS), controller.fetch)
.get("/api/users/:username", authorized(USER_MANAGEMENT), controller.find)
2020-06-26 21:05:09 +12:00
.put("/api/users/", authorized(USER_MANAGEMENT), controller.update)
.post("/api/users", authorized(USER_MANAGEMENT), usage, controller.create)
2020-05-22 01:31:23 +12:00
.delete(
2020-06-19 03:59:31 +12:00
"/api/users/:username",
2020-05-22 01:31:23 +12:00
authorized(USER_MANAGEMENT),
usage,
2020-05-22 01:31:23 +12:00
controller.destroy
)
2020-05-07 21:53:34 +12:00
module.exports = router