2022-09-23 01:59:28 +12:00
|
|
|
import Router from "@koa/router"
|
|
|
|
import * as controller from "../../controllers/global/self"
|
|
|
|
import { auth } from "@budibase/backend-core"
|
|
|
|
import { users } from "../validation"
|
2022-02-11 07:34:55 +13:00
|
|
|
|
2022-09-23 01:59:28 +12:00
|
|
|
const router = new Router()
|
2022-02-11 07:34:55 +13:00
|
|
|
|
|
|
|
router
|
2022-09-23 01:59:28 +12:00
|
|
|
.post("/api/global/self/api_key", auth.builderOnly, controller.generateAPIKey)
|
|
|
|
.get("/api/global/self/api_key", auth.builderOnly, controller.fetchAPIKey)
|
2022-02-15 07:11:35 +13:00
|
|
|
.get("/api/global/self", controller.getSelf)
|
|
|
|
.post(
|
|
|
|
"/api/global/self",
|
2022-04-08 12:28:22 +12:00
|
|
|
users.buildUserSaveValidation(true),
|
2022-02-15 07:11:35 +13:00
|
|
|
controller.updateSelf
|
|
|
|
)
|
2022-02-11 07:34:55 +13:00
|
|
|
|
2022-09-23 01:59:28 +12:00
|
|
|
export default router as any
|