1
0
Fork 0
mirror of synced 2024-10-03 19:43:32 +13:00

Fix validate test

This commit is contained in:
Adria Navarro 2023-09-08 10:17:22 +02:00
parent 2c6df74755
commit 93124d804b
2 changed files with 8 additions and 2 deletions

View file

@ -15,6 +15,7 @@ import {
SearchRowRequest,
SearchParams,
GetRowResponse,
ValidateResponse,
} from "@budibase/types"
import * as utils from "./utils"
import { gridSocket } from "../../../websockets"
@ -215,11 +216,11 @@ export async function search(ctx: Ctx<SearchRowRequest, SearchRowResponse>) {
})
}
export async function validate(ctx: Ctx) {
export async function validate(ctx: Ctx<Row, ValidateResponse>) {
const tableId = utils.getTableId(ctx)
// external tables are hard to validate currently
if (isExternalTable(tableId)) {
ctx.body = { valid: true }
ctx.body = { valid: true, errors: {} }
} else {
ctx.body = await sdk.rows.utils.validate({
row: ctx.request.body,

View file

@ -11,3 +11,8 @@ export interface DeleteRow {
}
export type DeleteRowRequest = DeleteRows | DeleteRow
export interface ValidateResponse {
valid: boolean
errors: Record<string, any>
}