Renames
This commit is contained in:
parent
56e6d48ec7
commit
fbccec64c7
|
@ -280,7 +280,7 @@ export function generateViewID(tableId: string) {
|
||||||
return `${tableId}${SEPARATOR}${newid()}`
|
return `${tableId}${SEPARATOR}${newid()}`
|
||||||
}
|
}
|
||||||
|
|
||||||
export function extractViewInfoFromId(viewId: string) {
|
export function extractViewInfoFromID(viewId: string) {
|
||||||
const regex = new RegExp(`^(?<tableId>.+)${SEPARATOR}([^${SEPARATOR}]+)$`)
|
const regex = new RegExp(`^(?<tableId>.+)${SEPARATOR}([^${SEPARATOR}]+)$`)
|
||||||
const res = regex.exec(viewId)
|
const res = regex.exec(viewId)
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import sdk from "../../../sdk"
|
||||||
import * as utils from "../../../db/utils"
|
import * as utils from "../../../db/utils"
|
||||||
|
|
||||||
export async function get(viewId: string): Promise<ViewV2 | undefined> {
|
export async function get(viewId: string): Promise<ViewV2 | undefined> {
|
||||||
const { tableId } = utils.extractViewInfoFromId(viewId)
|
const { tableId } = utils.extractViewInfoFromID(viewId)
|
||||||
const table = await sdk.tables.getTable(tableId)
|
const table = await sdk.tables.getTable(tableId)
|
||||||
const views = Object.values(table.views!)
|
const views = Object.values(table.views!)
|
||||||
const view = views.find(v => isV2(v) && v.id === viewId) as ViewV2 | undefined
|
const view = views.find(v => isV2(v) && v.id === viewId) as ViewV2 | undefined
|
||||||
|
|
Loading…
Reference in New Issue