1
0
Fork 0
mirror of synced 2024-09-05 04:01:48 +12:00

Fix viewV2 tests (for now)

This commit is contained in:
Sam Rose 2024-04-08 15:17:24 +01:00
parent 81cd2a1559
commit d2c0842c45
No known key found for this signature in database
3 changed files with 8 additions and 12 deletions

View file

@ -6,6 +6,7 @@ import {
UIFieldMetadata, UIFieldMetadata,
UpdateViewRequest, UpdateViewRequest,
ViewResponse, ViewResponse,
ViewResponseEnriched,
ViewV2, ViewV2,
} from "@budibase/types" } from "@budibase/types"
import { builderSocket, gridSocket } from "../../../websockets" import { builderSocket, gridSocket } from "../../../websockets"
@ -39,9 +40,9 @@ async function parseSchema(view: CreateViewRequest) {
return finalViewSchema return finalViewSchema
} }
export async function get(ctx: Ctx<void, ViewResponse>) { export async function get(ctx: Ctx<void, ViewResponseEnriched>) {
ctx.body = { ctx.body = {
data: await sdk.views.get(ctx.params.viewId), data: await sdk.views.getEnriched(ctx.params.viewId),
} }
} }

View file

@ -8,7 +8,6 @@ import {
import { db as dbCore } from "@budibase/backend-core" import { db as dbCore } from "@budibase/backend-core"
import { cloneDeep } from "lodash" import { cloneDeep } from "lodash"
import sdk from "../../../sdk"
import * as utils from "../../../db/utils" import * as utils from "../../../db/utils"
import { isExternalTableID } from "../../../integrations/utils" import { isExternalTableID } from "../../../integrations/utils"
@ -64,10 +63,6 @@ export function enrichSchema(
view: ViewV2, view: ViewV2,
tableSchema: TableSchema tableSchema: TableSchema
): ViewV2Enriched { ): ViewV2Enriched {
if (!sdk.views.isV2(view)) {
return view
}
let schema = cloneDeep(tableSchema) let schema = cloneDeep(tableSchema)
const anyViewOrder = Object.values(view.schema || {}).some( const anyViewOrder = Object.values(view.schema || {}).some(
ui => ui.order != null ui => ui.order != null

View file

@ -4,9 +4,9 @@ import {
ViewV2, ViewV2,
SearchViewRowRequest, SearchViewRowRequest,
PaginatedSearchRowResponse, PaginatedSearchRowResponse,
ViewV2Enriched,
} from "@budibase/types" } from "@budibase/types"
import { Expectations, TestAPI } from "./base" import { Expectations, TestAPI } from "./base"
import sdk from "../../../sdk"
export class ViewV2API extends TestAPI { export class ViewV2API extends TestAPI {
create = async ( create = async (
@ -44,10 +44,10 @@ export class ViewV2API extends TestAPI {
return await this._delete(`/api/v2/views/${viewId}`, { expectations: exp }) return await this._delete(`/api/v2/views/${viewId}`, { expectations: exp })
} }
get = async (viewId: string, expectations?: Expectations) => { get = async (viewId: string) => {
return await this._get<ViewV2Enriched>(`/api/v2/views/${viewId}`, { return await this.config.doInContext(this.config.getAppId(), () =>
expectations, sdk.views.get(viewId)
}) )
} }
search = async ( search = async (