cleanup.
This commit is contained in:
parent
7be67bf603
commit
1e4cbc769c
|
@ -2,11 +2,11 @@ import sdk from "../../../sdk"
|
||||||
import {
|
import {
|
||||||
CreateViewRequest,
|
CreateViewRequest,
|
||||||
Ctx,
|
Ctx,
|
||||||
|
RequiredKeys,
|
||||||
UIFieldMetadata,
|
UIFieldMetadata,
|
||||||
UpdateViewRequest,
|
UpdateViewRequest,
|
||||||
ViewResponse,
|
ViewResponse,
|
||||||
ViewV2,
|
ViewV2,
|
||||||
RequiredKeys,
|
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
import { builderSocket } from "../../../websockets"
|
import { builderSocket } from "../../../websockets"
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ async function parseSchemaUI(ctx: Ctx, view: CreateViewRequest) {
|
||||||
newObj: Record<string, any>,
|
newObj: Record<string, any>,
|
||||||
existingObj: Record<string, any>
|
existingObj: Record<string, any>
|
||||||
) {
|
) {
|
||||||
const result = Object.entries(newObj || {}).some(([key, value]) => {
|
return Object.entries(newObj || {}).some(([key, value]) => {
|
||||||
const isObject = typeof value === "object"
|
const isObject = typeof value === "object"
|
||||||
const existing = existingObj[key]
|
const existing = existingObj[key]
|
||||||
if (isObject && hasOverrides(value, existing || {})) {
|
if (isObject && hasOverrides(value, existing || {})) {
|
||||||
|
@ -29,8 +29,6 @@ async function parseSchemaUI(ctx: Ctx, view: CreateViewRequest) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return result
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const table = await sdk.tables.getTable(view.tableId)
|
const table = await sdk.tables.getTable(view.tableId)
|
||||||
|
@ -47,8 +45,7 @@ async function parseSchemaUI(ctx: Ctx, view: CreateViewRequest) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const schemaUI =
|
return view.schema &&
|
||||||
view.schema &&
|
|
||||||
Object.entries(view.schema).reduce((p, [fieldName, schemaValue]) => {
|
Object.entries(view.schema).reduce((p, [fieldName, schemaValue]) => {
|
||||||
const fieldSchema: RequiredKeys<UIFieldMetadata> = {
|
const fieldSchema: RequiredKeys<UIFieldMetadata> = {
|
||||||
order: schemaValue.order,
|
order: schemaValue.order,
|
||||||
|
@ -64,7 +61,6 @@ async function parseSchemaUI(ctx: Ctx, view: CreateViewRequest) {
|
||||||
p[fieldName] = fieldSchema
|
p[fieldName] = fieldSchema
|
||||||
return p
|
return p
|
||||||
}, {} as Record<string, RequiredKeys<UIFieldMetadata>>)
|
}, {} as Record<string, RequiredKeys<UIFieldMetadata>>)
|
||||||
return schemaUI
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function create(ctx: Ctx<CreateViewRequest, ViewResponse>) {
|
export async function create(ctx: Ctx<CreateViewRequest, ViewResponse>) {
|
||||||
|
|
Loading…
Reference in New Issue