Type response

This commit is contained in:
Adria Navarro 2023-09-08 10:04:35 +02:00
parent 3c46d66333
commit c6621e8c49
5 changed files with 7 additions and 4 deletions

View File

@ -106,7 +106,7 @@ export async function save(ctx: UserCtx) {
}
}
export async function find(ctx: UserCtx) {
export async function find(ctx: UserCtx): Promise<Row> {
const id = ctx.params.rowId
const tableId = utils.getTableId(ctx)
return sdk.rows.external.getRow(tableId, id)

View File

@ -14,6 +14,7 @@ import {
SearchRowResponse,
SearchRowRequest,
SearchParams,
GetRowResponse,
} from "@budibase/types"
import * as utils from "./utils"
import { gridSocket } from "../../../websockets"
@ -111,7 +112,7 @@ export async function fetch(ctx: any) {
})
}
export async function find(ctx: any) {
export async function find(ctx: UserCtx<void, GetRowResponse>) {
const tableId = utils.getTableId(ctx)
ctx.body = await quotas.addQuery(() => pickApi(tableId).find(ctx), {
datasourceId: tableId,

View File

@ -131,7 +131,7 @@ export async function save(ctx: UserCtx) {
})
}
export async function find(ctx: UserCtx) {
export async function find(ctx: UserCtx): Promise<Row> {
const tableId = utils.getTableId(ctx),
rowId = ctx.params.rowId
const table = await sdk.tables.getTable(tableId)

View File

@ -27,7 +27,7 @@ validateJs.extend(validateJs.validators.datetime, {
export async function findRow(ctx: UserCtx, tableId: string, rowId: string) {
const db = context.getAppDB()
let row
let row: Row
// TODO remove special user case in future
if (tableId === InternalTables.USER_METADATA) {
ctx.params = {

View File

@ -1,5 +1,7 @@
import { Row } from "../../../documents/app/row"
export interface GetRowResponse extends Row {}
export interface DeleteRows {
rows: (Row | string)[]
}