Fixing viewname enumeration.
This commit is contained in:
parent
b803a3fd93
commit
fc6111272e
|
@ -1,5 +1,5 @@
|
|||
const {
|
||||
ViewNames,
|
||||
ViewName,
|
||||
generateMemoryViewID,
|
||||
getMemoryViewParams,
|
||||
DocumentType,
|
||||
|
@ -32,7 +32,7 @@ exports.getViews = async () => {
|
|||
const designDoc = await db.get("_design/database")
|
||||
for (let name of Object.keys(designDoc.views)) {
|
||||
// Only return custom views, not built ins
|
||||
if (Object.values(ViewNames).indexOf(name) !== -1) {
|
||||
if (Object.values(ViewName).indexOf(name) !== -1) {
|
||||
continue
|
||||
}
|
||||
response.push({
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const Sentry = require("@sentry/node")
|
||||
const { ViewNames, getQueryIndex } = require("../utils")
|
||||
const { ViewName, getQueryIndex } = require("../utils")
|
||||
const { FieldTypes } = require("../../constants")
|
||||
const { createLinkView } = require("../views/staticViews")
|
||||
const { getAppDB } = require("@budibase/backend-core/context")
|
||||
|
@ -41,7 +41,7 @@ exports.getLinkDocuments = async function (args) {
|
|||
}
|
||||
params.include_docs = !!includeDocs
|
||||
try {
|
||||
let linkRows = (await db.query(getQueryIndex(ViewNames.LINK), params)).rows
|
||||
let linkRows = (await db.query(getQueryIndex(ViewName.LINK), params)).rows
|
||||
// filter to get unique entries
|
||||
const foundIds = []
|
||||
linkRows = linkRows.filter(link => {
|
||||
|
|
|
@ -12,7 +12,7 @@ const {
|
|||
getDevelopmentAppID,
|
||||
generateAppID,
|
||||
getQueryIndex,
|
||||
ViewNames,
|
||||
ViewName,
|
||||
} = require("@budibase/backend-core/db")
|
||||
|
||||
const UNICODE_MAX = "\ufff0"
|
||||
|
@ -69,7 +69,7 @@ exports.isProdAppID = isProdAppID
|
|||
exports.USER_METDATA_PREFIX = `${DocumentType.ROW}${SEPARATOR}${InternalTables.USER_METADATA}${SEPARATOR}`
|
||||
exports.LINK_USER_METADATA_PREFIX = `${DocumentType.LINK}${SEPARATOR}${InternalTables.USER_METADATA}${SEPARATOR}`
|
||||
exports.TABLE_ROW_PREFIX = `${DocumentType.ROW}${SEPARATOR}${DocumentType.TABLE}`
|
||||
exports.ViewNames = ViewNames
|
||||
exports.ViewName = ViewName
|
||||
exports.InternalTables = InternalTables
|
||||
exports.DocumentType = DocumentType
|
||||
exports.SEPARATOR = SEPARATOR
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
const { getAppDB } = require("@budibase/backend-core/context")
|
||||
const {
|
||||
DocumentType,
|
||||
SEPARATOR,
|
||||
ViewNames,
|
||||
SearchIndexes,
|
||||
} = require("../utils")
|
||||
const { DocumentType, SEPARATOR, ViewName, SearchIndexes } = require("../utils")
|
||||
const SCREEN_PREFIX = DocumentType.SCREEN + SEPARATOR
|
||||
|
||||
/**************************************************
|
||||
|
@ -53,7 +48,7 @@ exports.createLinkView = async () => {
|
|||
}
|
||||
designDoc.views = {
|
||||
...designDoc.views,
|
||||
[ViewNames.LINK]: view,
|
||||
[ViewName.LINK]: view,
|
||||
}
|
||||
await db.put(designDoc)
|
||||
}
|
||||
|
@ -74,7 +69,7 @@ exports.createRoutingView = async () => {
|
|||
}
|
||||
designDoc.views = {
|
||||
...designDoc.views,
|
||||
[ViewNames.ROUTING]: view,
|
||||
[ViewName.ROUTING]: view,
|
||||
}
|
||||
await db.put(designDoc)
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
const { createRoutingView } = require("../../db/views/staticViews")
|
||||
const { ViewNames, getQueryIndex, UNICODE_MAX } = require("../../db/utils")
|
||||
const { ViewName, getQueryIndex, UNICODE_MAX } = require("../../db/utils")
|
||||
const { getAppDB } = require("@budibase/backend-core/context")
|
||||
|
||||
exports.getRoutingInfo = async () => {
|
||||
const db = getAppDB()
|
||||
try {
|
||||
const allRouting = await db.query(getQueryIndex(ViewNames.ROUTING), {
|
||||
const allRouting = await db.query(getQueryIndex(ViewName.ROUTING), {
|
||||
startKey: "",
|
||||
endKey: UNICODE_MAX,
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue