Some fixes after re-running server tests.
This commit is contained in:
parent
d6e9380c06
commit
3aeb6653c6
|
@ -1,6 +1,6 @@
|
||||||
import * as rowController from "../row"
|
import * as rowController from "../row"
|
||||||
import { addRev } from "./utils"
|
import { addRev } from "./utils"
|
||||||
import { Row } from "../../../definitions/common"
|
import { Row } from "@budibase/types"
|
||||||
import { convertBookmark } from "../../../utilities"
|
import { convertBookmark } from "../../../utilities"
|
||||||
|
|
||||||
// makes sure that the user doesn't need to pass in the type, tableId or _id params for
|
// makes sure that the user doesn't need to pass in the type, tableId or _id params for
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const { getAppDB } = require("@budibase/backend-core/context")
|
import { context } from "@budibase/backend-core"
|
||||||
import { isExternalTable } from "../../../integrations/utils"
|
import { isExternalTable } from "../../../integrations/utils"
|
||||||
import { APP_PREFIX, DocumentType } from "../../../db/utils"
|
import { APP_PREFIX, DocumentType } from "../../../db/utils"
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ export async function addRev(
|
||||||
if (body._id.startsWith(APP_PREFIX)) {
|
if (body._id.startsWith(APP_PREFIX)) {
|
||||||
id = DocumentType.APP_METADATA
|
id = DocumentType.APP_METADATA
|
||||||
}
|
}
|
||||||
const db = getAppDB()
|
const db = context.getAppDB()
|
||||||
const dbDoc = await db.get(id)
|
const dbDoc = await db.get(id)
|
||||||
body._rev = dbDoc._rev
|
body._rev = dbDoc._rev
|
||||||
// update ID in case it is an app ID
|
// update ID in case it is an app ID
|
||||||
|
|
|
@ -12,11 +12,8 @@ import env from "../../../environment"
|
||||||
// below imports don't have declaration files
|
// below imports don't have declaration files
|
||||||
const Router = require("@koa/router")
|
const Router = require("@koa/router")
|
||||||
const { RateLimit, Stores } = require("koa2-ratelimit")
|
const { RateLimit, Stores } = require("koa2-ratelimit")
|
||||||
const {
|
import { redis, permissions } from "@budibase/backend-core"
|
||||||
PermissionLevel,
|
const { PermissionType, PermissionLevel } = permissions
|
||||||
PermissionType,
|
|
||||||
} = require("@budibase/backend-core/permissions")
|
|
||||||
const { getRedisOptions } = require("@budibase/backend-core/redis").utils
|
|
||||||
|
|
||||||
const PREFIX = "/api/public/v1"
|
const PREFIX = "/api/public/v1"
|
||||||
// allow a lot more requests when in test
|
// allow a lot more requests when in test
|
||||||
|
@ -31,7 +28,7 @@ function getApiLimitPerSecond(): number {
|
||||||
|
|
||||||
let rateLimitStore: any = null
|
let rateLimitStore: any = null
|
||||||
if (!env.isTest()) {
|
if (!env.isTest()) {
|
||||||
const REDIS_OPTS = getRedisOptions()
|
const REDIS_OPTS = redis.utils.getRedisOptions()
|
||||||
let options
|
let options
|
||||||
if (REDIS_OPTS.redisProtocolUrl) {
|
if (REDIS_OPTS.redisProtocolUrl) {
|
||||||
// fully qualified redis URL
|
// fully qualified redis URL
|
||||||
|
|
|
@ -20,7 +20,7 @@ export async function getFetchResponse(fetched: any) {
|
||||||
// throw added to them, so that controllers don't
|
// throw added to them, so that controllers don't
|
||||||
// throw a ctx.throw undefined when error occurs
|
// throw a ctx.throw undefined when error occurs
|
||||||
// opts can contain, body, params and version
|
// opts can contain, body, params and version
|
||||||
export async function buildCtx(
|
export function buildCtx(
|
||||||
appId: string,
|
appId: string,
|
||||||
emitter?: EventEmitter | null,
|
emitter?: EventEmitter | null,
|
||||||
opts: any = {}
|
opts: any = {}
|
||||||
|
|
Loading…
Reference in New Issue