Some updates, typescripting some more APIs, as well as fixing a lot of Router creation which did not specify the 'new' operator.
This commit is contained in:
parent
c382b86fb2
commit
67d9495481
|
@ -15,7 +15,7 @@ A package that handles all common components across the Budibase organisation. Y
|
|||
1. Create a file: `Headline.svelte`
|
||||
2. Create a Svench file: `Headline.svench`
|
||||
3. Build component and add variants to the Svench file.
|
||||
4. Once done, re-export the file in `src/index.js`.
|
||||
4. Once done, re-export the file in `src/index.ts`.
|
||||
5. Publish, update the package in the main project and profit.
|
||||
|
||||
## Guidelines
|
||||
|
|
|
@ -6,7 +6,7 @@ import { terser } from "rollup-plugin-terser"
|
|||
import postcss from "rollup-plugin-postcss"
|
||||
|
||||
export default {
|
||||
input: "src/index.js",
|
||||
input: "src/index.ts",
|
||||
output: {
|
||||
sourcemap: true,
|
||||
format: "esm",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/// <reference types="cypress" />
|
||||
// ***********************************************************
|
||||
// This example plugins/index.js can be used to load plugins
|
||||
// This example plugins/index.ts can be used to load plugins
|
||||
//
|
||||
// You can change the location of this file or turn off loading
|
||||
// the plugins file with the 'pluginsFile' configuration option.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// ***********************************************************
|
||||
// This example support/index.js is processed and
|
||||
// This example support/index.ts is processed and
|
||||
// loaded automatically before your test files.
|
||||
//
|
||||
// This is a great place to put global configuration and
|
||||
|
|
|
@ -8,7 +8,7 @@ their settings, and know how to correctly interact with them.
|
|||
|
||||
### Component Definitions
|
||||
|
||||
The object key is the name of the component, as exported by `index.js`.
|
||||
The object key is the name of the component, as exported by `index.ts`.
|
||||
|
||||
- **name** - the name displayed in the builder
|
||||
- **description** - not currently used
|
||||
|
|
|
@ -19,7 +19,7 @@ const ignoredWarnings = [
|
|||
]
|
||||
|
||||
export default {
|
||||
input: "src/index.js",
|
||||
input: "src/index.ts",
|
||||
output: [
|
||||
{
|
||||
sourcemap: false,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script>
|
||||
import { Layout, Select, Body } from "@budibase/bbui"
|
||||
import { componentStore } from "stores/index.js"
|
||||
import { componentStore } from "stores/index.ts"
|
||||
import DevToolsStat from "./DevToolsStat.svelte"
|
||||
|
||||
const ReadableBindingMap = {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script>
|
||||
import { Layout, Toggle } from "@budibase/bbui"
|
||||
import DevToolsStat from "./DevToolsStat.svelte"
|
||||
import { componentStore } from "stores/index.js"
|
||||
import { componentStore } from "stores/index.ts"
|
||||
import { getSettingsDefinition } from "utils/componentProps.js"
|
||||
|
||||
let showEnrichedSettings = true
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module.exports = {
|
||||
apps: [
|
||||
{
|
||||
script: "dist/index.js",
|
||||
script: "dist/index.ts",
|
||||
instances: "max",
|
||||
exec_mode: "cluster",
|
||||
},
|
||||
|
|
|
@ -1,19 +1,18 @@
|
|||
const { outputProcessing } = require("../../utilities/rowProcessor")
|
||||
const { InternalTables } = require("../../db/utils")
|
||||
const { getFullUser } = require("../../utilities/users")
|
||||
const { BUILTIN_ROLE_IDS } = require("@budibase/backend-core/roles")
|
||||
const { getAppDB, getAppId } = require("@budibase/backend-core/context")
|
||||
import { outputProcessing } from "../../utilities/rowProcessor"
|
||||
import { InternalTables } from "../../db/utils"
|
||||
import { getFullUser } from "../../utilities/users"
|
||||
import { roles, context } from "@budibase/backend-core"
|
||||
|
||||
/**
|
||||
* Add the attributes that are session based to the current user.
|
||||
*/
|
||||
const addSessionAttributesToUser = ctx => {
|
||||
const addSessionAttributesToUser = (ctx: any) => {
|
||||
if (ctx.user) {
|
||||
ctx.body.license = ctx.user.license
|
||||
}
|
||||
}
|
||||
|
||||
exports.fetchSelf = async ctx => {
|
||||
export async function fetchSelf(ctx: any) {
|
||||
let userId = ctx.user.userId || ctx.user._id
|
||||
/* istanbul ignore next */
|
||||
if (!userId || !ctx.isAuthenticated) {
|
||||
|
@ -27,8 +26,8 @@ exports.fetchSelf = async ctx => {
|
|||
// forward the csrf token from the session
|
||||
user.csrfToken = ctx.user.csrfToken
|
||||
|
||||
if (getAppId()) {
|
||||
const db = getAppDB()
|
||||
if (context.getAppId()) {
|
||||
const db = context.getAppDB()
|
||||
// remove the full roles structure
|
||||
delete user.roles
|
||||
try {
|
||||
|
@ -41,10 +40,10 @@ exports.fetchSelf = async ctx => {
|
|||
...user,
|
||||
...metadata,
|
||||
})
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
let response
|
||||
// user didn't exist in app, don't pretend they do
|
||||
if (user.roleId === BUILTIN_ROLE_IDS.PUBLIC) {
|
||||
if (user.roleId === roles.BUILTIN_ROLE_IDS.PUBLIC) {
|
||||
response = {}
|
||||
}
|
||||
// user has a role of some sort, return them
|
|
@ -1,7 +1,7 @@
|
|||
const Router = require("@koa/router")
|
||||
const controller = require("../controllers/analytics")
|
||||
|
||||
const router = Router()
|
||||
const router = new Router()
|
||||
|
||||
router.get("/api/bbtel", controller.isEnabled)
|
||||
router.post("/api/bbtel/ping", controller.ping)
|
||||
|
|
|
@ -3,7 +3,7 @@ const controller = require("../controllers/apikeys")
|
|||
const authorized = require("../../middleware/authorized")
|
||||
const { BUILDER } = require("@budibase/backend-core/permissions")
|
||||
|
||||
const router = Router()
|
||||
const router = new Router()
|
||||
|
||||
router
|
||||
.get("/api/keys", authorized(BUILDER), controller.fetch)
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
const Router = require("@koa/router")
|
||||
const controller = require("../controllers/auth")
|
||||
|
||||
const router = Router()
|
||||
|
||||
router.get("/api/self", controller.fetchSelf)
|
||||
|
||||
module.exports = router
|
|
@ -0,0 +1,8 @@
|
|||
import Router from "@koa/router"
|
||||
import * as controller from "../controllers/auth"
|
||||
|
||||
const router = new Router()
|
||||
|
||||
router.get("/api/self", controller.fetchSelf)
|
||||
|
||||
export default router
|
|
@ -13,7 +13,7 @@ const {
|
|||
} = require("../../middleware/appInfo")
|
||||
const { automationValidator } = require("./utils/validators")
|
||||
|
||||
const router = Router()
|
||||
const router = new Router()
|
||||
|
||||
router
|
||||
.get(
|
||||
|
|
|
@ -3,7 +3,7 @@ const controller = require("../controllers/backup")
|
|||
const authorized = require("../../middleware/authorized")
|
||||
const { BUILDER } = require("@budibase/backend-core/permissions")
|
||||
|
||||
const router = Router()
|
||||
const router = new Router()
|
||||
|
||||
router.get("/api/backups/export", authorized(BUILDER), controller.exportAppDump)
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ const controller = require("../controllers/cloud")
|
|||
const authorized = require("../../middleware/authorized")
|
||||
const { BUILDER } = require("@budibase/backend-core/permissions")
|
||||
|
||||
const router = Router()
|
||||
const router = new Router()
|
||||
|
||||
router
|
||||
.get("/api/cloud/export", authorized(BUILDER), controller.exportApps)
|
||||
|
|
|
@ -3,7 +3,7 @@ const controller = require("../controllers/component")
|
|||
const authorized = require("../../middleware/authorized")
|
||||
const { BUILDER } = require("@budibase/backend-core/permissions")
|
||||
|
||||
const router = Router()
|
||||
const router = new Router()
|
||||
|
||||
router.get(
|
||||
"/api/:appId/components/definitions",
|
||||
|
|
|
@ -11,7 +11,7 @@ const {
|
|||
datasourceQueryValidator,
|
||||
} = require("./utils/validators")
|
||||
|
||||
const router = Router()
|
||||
const router = new Router()
|
||||
|
||||
router
|
||||
.get("/api/datasources", authorized(BUILDER), datasourceController.fetch)
|
||||
|
|
|
@ -3,7 +3,7 @@ const controller = require("../controllers/deploy")
|
|||
const authorized = require("../../middleware/authorized")
|
||||
const { BUILDER } = require("@budibase/backend-core/permissions")
|
||||
|
||||
const router = Router()
|
||||
const router = new Router()
|
||||
|
||||
router
|
||||
.get("/api/deployments", authorized(BUILDER), controller.fetchDeployments)
|
||||
|
|
|
@ -4,7 +4,7 @@ const env = require("../../environment")
|
|||
const authorized = require("../../middleware/authorized")
|
||||
const { BUILDER } = require("@budibase/backend-core/permissions")
|
||||
|
||||
const router = Router()
|
||||
const router = new Router()
|
||||
|
||||
function redirectPath(path) {
|
||||
router
|
||||
|
|
|
@ -3,7 +3,7 @@ const controller = require("../controllers/integration")
|
|||
const authorized = require("../../middleware/authorized")
|
||||
const { BUILDER } = require("@budibase/backend-core/permissions")
|
||||
|
||||
const router = Router()
|
||||
const router = new Router()
|
||||
|
||||
router
|
||||
.get("/api/integrations", authorized(BUILDER), controller.fetch)
|
||||
|
|
|
@ -3,7 +3,7 @@ const authorized = require("../../middleware/authorized")
|
|||
const { BUILDER } = require("@budibase/backend-core/permissions")
|
||||
const controller = require("../controllers/layout")
|
||||
|
||||
const router = Router()
|
||||
const router = new Router()
|
||||
|
||||
router
|
||||
.post("/api/layouts", authorized(BUILDER), controller.save)
|
||||
|
|
|
@ -7,7 +7,7 @@ const {
|
|||
const authorized = require("../../middleware/authorized")
|
||||
const { BUILDER } = require("@budibase/backend-core/permissions")
|
||||
|
||||
const router = Router()
|
||||
const router = new Router()
|
||||
|
||||
router
|
||||
.post(
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Router = require("@koa/router")
|
||||
const migrationsController = require("../controllers/migrations")
|
||||
const router = Router()
|
||||
const router = new Router()
|
||||
const { internalApi } = require("@budibase/backend-core/auth")
|
||||
|
||||
router
|
||||
|
|
|
@ -4,7 +4,7 @@ const authorized = require("../../middleware/authorized")
|
|||
const { BUILDER } = require("@budibase/backend-core/permissions")
|
||||
const { permissionValidator } = require("./utils/validators")
|
||||
|
||||
const router = Router()
|
||||
const router = new Router()
|
||||
|
||||
router
|
||||
.get("/api/permission/builtin", authorized(BUILDER), controller.fetchBuiltin)
|
||||
|
|
|
@ -16,7 +16,7 @@ const {
|
|||
generateQueryValidation,
|
||||
} = require("../controllers/query/validation")
|
||||
|
||||
const router = Router()
|
||||
const router = new Router()
|
||||
|
||||
router
|
||||
.get("/api/queries", authorized(BUILDER), queryController.fetch)
|
||||
|
|
|
@ -4,7 +4,7 @@ const authorized = require("../../middleware/authorized")
|
|||
const { BUILDER } = require("@budibase/backend-core/permissions")
|
||||
const { roleValidator } = require("./utils/validators")
|
||||
|
||||
const router = Router()
|
||||
const router = new Router()
|
||||
|
||||
router
|
||||
.post("/api/roles", authorized(BUILDER), roleValidator(), controller.save)
|
||||
|
|
|
@ -3,7 +3,7 @@ const authorized = require("../../middleware/authorized")
|
|||
const { BUILDER } = require("@budibase/backend-core/permissions")
|
||||
const controller = require("../controllers/routing")
|
||||
|
||||
const router = Router()
|
||||
const router = new Router()
|
||||
|
||||
router
|
||||
// gets correct structure for user role
|
||||
|
|
|
@ -4,7 +4,7 @@ const authorized = require("../../middleware/authorized")
|
|||
const { BUILDER } = require("@budibase/backend-core/permissions")
|
||||
const { screenValidator } = require("./utils/validators")
|
||||
|
||||
const router = Router()
|
||||
const router = new Router()
|
||||
|
||||
router
|
||||
.get("/api/screens", authorized(BUILDER), controller.fetch)
|
||||
|
|
|
@ -3,7 +3,7 @@ const controller = require("../controllers/script")
|
|||
const authorized = require("../../middleware/authorized")
|
||||
const { BUILDER } = require("@budibase/backend-core/permissions")
|
||||
|
||||
const router = Router()
|
||||
const router = new Router()
|
||||
|
||||
router.post("/api/script", authorized(BUILDER), controller.save)
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ const {
|
|||
} = require("@budibase/backend-core/permissions")
|
||||
const { tableValidator } = require("./utils/validators")
|
||||
|
||||
const router = Router()
|
||||
const router = new Router()
|
||||
|
||||
router
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,7 @@ const controller = require("../controllers/templates")
|
|||
const authorized = require("../../middleware/authorized")
|
||||
const { BUILDER } = require("@budibase/backend-core/permissions")
|
||||
|
||||
const router = Router()
|
||||
const router = new Router()
|
||||
|
||||
router
|
||||
.get("/api/templates", authorized(BUILDER), controller.fetch)
|
||||
|
|
|
@ -6,7 +6,7 @@ const {
|
|||
PermissionTypes,
|
||||
} = require("@budibase/backend-core/permissions")
|
||||
|
||||
const router = Router()
|
||||
const router = new Router()
|
||||
|
||||
router
|
||||
.get(
|
||||
|
|
|
@ -9,7 +9,7 @@ const {
|
|||
PermissionLevels,
|
||||
} = require("@budibase/backend-core/permissions")
|
||||
|
||||
const router = Router()
|
||||
const router = new Router()
|
||||
|
||||
router
|
||||
.get("/api/views/export", authorized(BUILDER), viewController.exportView)
|
||||
|
|
|
@ -4,7 +4,7 @@ const authorized = require("../../middleware/authorized")
|
|||
const { BUILDER } = require("@budibase/backend-core/permissions")
|
||||
const { webhookValidator } = require("./utils/validators")
|
||||
|
||||
const router = Router()
|
||||
const router = new Router()
|
||||
|
||||
router
|
||||
.get("/api/webhooks", authorized(BUILDER), controller.fetch)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module.exports = {
|
||||
apps: [
|
||||
{
|
||||
script: "./dist/index.js",
|
||||
script: "./dist/index.ts",
|
||||
instances: "max",
|
||||
exec_mode: "cluster",
|
||||
},
|
||||
|
|
|
@ -30,7 +30,7 @@ function cleanupDevInfo(info: any) {
|
|||
return info
|
||||
}
|
||||
|
||||
exports.generateAPIKey = async (ctx: any) => {
|
||||
export async function generateAPIKey(ctx: any) {
|
||||
let userId
|
||||
let apiKey
|
||||
if (env.isTest() && ctx.request.body.userId) {
|
||||
|
@ -54,7 +54,7 @@ exports.generateAPIKey = async (ctx: any) => {
|
|||
ctx.body = cleanupDevInfo(devInfo)
|
||||
}
|
||||
|
||||
exports.fetchAPIKey = async (ctx: any) => {
|
||||
export async function fetchAPIKey(ctx: any) {
|
||||
const db = tenancy.getGlobalDB()
|
||||
const id = dbCore.generateDevInfoID(ctx.user._id)
|
||||
let devInfo
|
||||
|
@ -103,7 +103,7 @@ const sanitiseUserUpdate = (ctx: any) => {
|
|||
return resp
|
||||
}
|
||||
|
||||
exports.getSelf = async (ctx: any) => {
|
||||
export async function getSelf(ctx: any) {
|
||||
if (!ctx.user) {
|
||||
ctx.throw(403, "User not logged in")
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ exports.getSelf = async (ctx: any) => {
|
|||
addSessionAttributesToUser(ctx)
|
||||
}
|
||||
|
||||
exports.updateSelf = async (ctx: any) => {
|
||||
export async function updateSelf(ctx: any) {
|
||||
const db = tenancy.getGlobalDB()
|
||||
const user = await db.get(ctx.user._id)
|
||||
let passwordChange = false
|
||||
|
|
|
@ -1,20 +1,19 @@
|
|||
const { generateTemplateID } = require("@budibase/backend-core/db")
|
||||
const {
|
||||
import {
|
||||
TemplateMetadata,
|
||||
TemplateBindings,
|
||||
GLOBAL_OWNER,
|
||||
} = require("../../../constants")
|
||||
const { getTemplates } = require("../../../constants/templates")
|
||||
const { getGlobalDB } = require("@budibase/backend-core/tenancy")
|
||||
} from "../../../constants"
|
||||
import { getTemplates } from "../../../constants/templates"
|
||||
import { tenancy, db as dbCore } from "@budibase/backend-core"
|
||||
|
||||
exports.save = async ctx => {
|
||||
const db = getGlobalDB()
|
||||
export async function save(ctx: any) {
|
||||
const db = tenancy.getGlobalDB()
|
||||
let template = ctx.request.body
|
||||
if (!template.ownerId) {
|
||||
template.ownerId = GLOBAL_OWNER
|
||||
}
|
||||
if (!template._id) {
|
||||
template._id = generateTemplateID(template.ownerId)
|
||||
template._id = dbCore.generateTemplateID(template.ownerId)
|
||||
}
|
||||
|
||||
const response = await db.put(template)
|
||||
|
@ -24,9 +23,9 @@ exports.save = async ctx => {
|
|||
}
|
||||
}
|
||||
|
||||
exports.definitions = async ctx => {
|
||||
const bindings = {}
|
||||
const info = {}
|
||||
export async function definitions(ctx: any) {
|
||||
const bindings: any = {}
|
||||
const info: any = {}
|
||||
for (let template of TemplateMetadata.email) {
|
||||
bindings[template.purpose] = template.bindings
|
||||
info[template.purpose] = {
|
||||
|
@ -45,30 +44,33 @@ exports.definitions = async ctx => {
|
|||
}
|
||||
}
|
||||
|
||||
exports.fetch = async ctx => {
|
||||
export async function fetch(ctx: any) {
|
||||
ctx.body = await getTemplates()
|
||||
}
|
||||
|
||||
exports.fetchByType = async ctx => {
|
||||
export async function fetchByType(ctx: any) {
|
||||
// @ts-ignore
|
||||
ctx.body = await getTemplates({
|
||||
type: ctx.params.type,
|
||||
})
|
||||
}
|
||||
|
||||
exports.fetchByOwner = async ctx => {
|
||||
export async function fetchByOwner(ctx: any) {
|
||||
// @ts-ignore
|
||||
ctx.body = await getTemplates({
|
||||
ownerId: ctx.params.ownerId,
|
||||
})
|
||||
}
|
||||
|
||||
exports.find = async ctx => {
|
||||
export async function find(ctx: any) {
|
||||
// @ts-ignore
|
||||
ctx.body = await getTemplates({
|
||||
id: ctx.params.id,
|
||||
})
|
||||
}
|
||||
|
||||
exports.destroy = async ctx => {
|
||||
const db = getGlobalDB()
|
||||
export async function destroy(ctx: any) {
|
||||
const db = tenancy.getGlobalDB()
|
||||
await db.remove(ctx.params.id, ctx.params.rev)
|
||||
ctx.message = `Template ${ctx.params.id} deleted.`
|
||||
ctx.status = 200
|
|
@ -4,7 +4,7 @@ const { joiValidator } = require("@budibase/backend-core/auth")
|
|||
const Joi = require("joi")
|
||||
const { updateTenantId } = require("@budibase/backend-core/tenancy")
|
||||
|
||||
const router = Router()
|
||||
const router = new Router()
|
||||
|
||||
function buildAuthValidation() {
|
||||
// prettier-ignore
|
||||
|
|
|
@ -5,7 +5,7 @@ const { adminOnly } = require("@budibase/backend-core/auth")
|
|||
const Joi = require("joi")
|
||||
const { Configs } = require("../../../constants")
|
||||
|
||||
const router = Router()
|
||||
const router = new Router()
|
||||
|
||||
function smtpValidation() {
|
||||
// prettier-ignore
|
||||
|
|
|
@ -5,7 +5,7 @@ const { joiValidator } = require("@budibase/backend-core/auth")
|
|||
const { adminOnly } = require("@budibase/backend-core/auth")
|
||||
const Joi = require("joi")
|
||||
|
||||
const router = Router()
|
||||
const router = new Router()
|
||||
|
||||
function buildEmailSendValidation() {
|
||||
// prettier-ignore
|
||||
|
|
|
@ -2,7 +2,7 @@ const Router = require("@koa/router")
|
|||
const controller = require("../../controllers/global/roles")
|
||||
const { builderOrAdmin } = require("@budibase/backend-core/auth")
|
||||
|
||||
const router = Router()
|
||||
const router = new Router()
|
||||
|
||||
router
|
||||
.get("/api/global/roles", builderOrAdmin, controller.fetch)
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
const Router = require("@koa/router")
|
||||
const controller = require("../../controllers/global/self")
|
||||
const { builderOnly } = require("@budibase/backend-core/auth")
|
||||
const { users } = require("../validation")
|
||||
import Router from "@koa/router"
|
||||
import * as controller from "../../controllers/global/self"
|
||||
import { auth } from "@budibase/backend-core"
|
||||
import { users } from "../validation"
|
||||
|
||||
const router = Router()
|
||||
const router = new Router()
|
||||
|
||||
router
|
||||
.post("/api/global/self/api_key", builderOnly, controller.generateAPIKey)
|
||||
.get("/api/global/self/api_key", builderOnly, controller.fetchAPIKey)
|
||||
.post("/api/global/self/api_key", auth.builderOnly, controller.generateAPIKey)
|
||||
.get("/api/global/self/api_key", auth.builderOnly, controller.fetchAPIKey)
|
||||
.get("/api/global/self", controller.getSelf)
|
||||
.post(
|
||||
"/api/global/self",
|
||||
|
@ -15,4 +15,4 @@ router
|
|||
controller.updateSelf
|
||||
)
|
||||
|
||||
module.exports = router
|
||||
export default router as any
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import Router from "@koa/router"
|
||||
import controller from "../../controllers/global/templates"
|
||||
import * as controller from "../../controllers/global/templates"
|
||||
import { TemplatePurpose, TemplateTypes } from "../../../constants"
|
||||
import { auth as authCore } from "@budibase/backend-core"
|
||||
import Joi from "joi"
|
||||
const { adminOnly, joiValidator } = authCore
|
||||
|
||||
const router = Router()
|
||||
const router = new Router()
|
||||
|
||||
function buildTemplateSaveValidation() {
|
||||
// prettier-ignore
|
||||
|
@ -34,4 +34,4 @@ router
|
|||
.get("/api/global/template/:id", controller.find)
|
||||
.delete("/api/global/template/:id/:rev", adminOnly, controller.destroy)
|
||||
|
||||
module.exports = router
|
||||
export default router
|
|
@ -8,7 +8,7 @@ const { users } = require("../validation")
|
|||
const selfController = require("../../controllers/global/self")
|
||||
const { builderOrAdmin } = require("@budibase/backend-core/auth")
|
||||
|
||||
const router = Router()
|
||||
const router = new Router()
|
||||
|
||||
function buildAdminInitValidation() {
|
||||
return joiValidator.body(
|
||||
|
|
|
@ -4,7 +4,7 @@ const { joiValidator } = require("@budibase/backend-core/auth")
|
|||
const { adminOnly } = require("@budibase/backend-core/auth")
|
||||
const Joi = require("joi")
|
||||
|
||||
const router = Router()
|
||||
const router = new Router()
|
||||
|
||||
function buildWorkspaceSaveValidation() {
|
||||
// prettier-ignore
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
const { api } = require("@budibase/pro")
|
||||
const userRoutes = require("./global/users")
|
||||
const configRoutes = require("./global/configs")
|
||||
const workspaceRoutes = require("./global/workspaces")
|
||||
const templateRoutes = require("./global/templates")
|
||||
const emailRoutes = require("./global/email")
|
||||
const authRoutes = require("./global/auth")
|
||||
const roleRoutes = require("./global/roles")
|
||||
const environmentRoutes = require("./system/environment")
|
||||
const tenantsRoutes = require("./system/tenants")
|
||||
const statusRoutes = require("./system/status")
|
||||
const selfRoutes = require("./global/self")
|
||||
const licenseRoutes = require("./global/license")
|
||||
const migrationRoutes = require("./system/migrations")
|
||||
const accountRoutes = require("./system/accounts")
|
||||
|
||||
let userGroupRoutes = api.groups
|
||||
exports.routes = [
|
||||
configRoutes,
|
||||
userRoutes,
|
||||
workspaceRoutes,
|
||||
authRoutes,
|
||||
templateRoutes,
|
||||
tenantsRoutes,
|
||||
emailRoutes,
|
||||
roleRoutes,
|
||||
environmentRoutes,
|
||||
statusRoutes,
|
||||
selfRoutes,
|
||||
licenseRoutes,
|
||||
userGroupRoutes,
|
||||
migrationRoutes,
|
||||
accountRoutes,
|
||||
]
|
|
@ -0,0 +1,34 @@
|
|||
import { api } from "@budibase/pro"
|
||||
import userRoutes from "./global/users"
|
||||
import configRoutes from "./global/configs"
|
||||
import workspaceRoutes from "./global/workspaces"
|
||||
import templateRoutes from "./global/templates"
|
||||
import emailRoutes from "./global/email"
|
||||
import authRoutes from "./global/auth"
|
||||
import roleRoutes from "./global/roles"
|
||||
import environmentRoutes from "./system/environment"
|
||||
import tenantsRoutes from "./system/tenants"
|
||||
import statusRoutes from "./system/status"
|
||||
import selfRoutes from "./global/self"
|
||||
import licenseRoutes from "./global/license"
|
||||
import migrationRoutes from "./system/migrations"
|
||||
import accountRoutes from "./system/accounts"
|
||||
|
||||
let userGroupRoutes = api.groups
|
||||
export const routes = [
|
||||
configRoutes,
|
||||
userRoutes,
|
||||
workspaceRoutes,
|
||||
authRoutes,
|
||||
templateRoutes,
|
||||
tenantsRoutes,
|
||||
emailRoutes,
|
||||
roleRoutes,
|
||||
environmentRoutes,
|
||||
statusRoutes,
|
||||
selfRoutes,
|
||||
licenseRoutes,
|
||||
userGroupRoutes,
|
||||
migrationRoutes,
|
||||
accountRoutes,
|
||||
]
|
|
@ -1,7 +1,7 @@
|
|||
const Router = require("@koa/router")
|
||||
const controller = require("../../controllers/system/environment")
|
||||
|
||||
const router = Router()
|
||||
const router = new Router()
|
||||
|
||||
router.get("/api/system/environment", controller.fetch)
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Router = require("@koa/router")
|
||||
const controller = require("../../controllers/system/status")
|
||||
|
||||
const router = Router()
|
||||
const router = new Router()
|
||||
|
||||
router.get("/api/system/status", controller.fetch)
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ const Router = require("@koa/router")
|
|||
const controller = require("../../controllers/system/tenants")
|
||||
const { adminOnly } = require("@budibase/backend-core/auth")
|
||||
|
||||
const router = Router()
|
||||
const router = new Router()
|
||||
|
||||
router
|
||||
.get("/api/system/tenants/:tenantId/exists", controller.exists)
|
||||
|
|
Loading…
Reference in New Issue