Type response
This commit is contained in:
parent
3c46d66333
commit
c6621e8c49
|
@ -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 id = ctx.params.rowId
|
||||||
const tableId = utils.getTableId(ctx)
|
const tableId = utils.getTableId(ctx)
|
||||||
return sdk.rows.external.getRow(tableId, id)
|
return sdk.rows.external.getRow(tableId, id)
|
||||||
|
|
|
@ -14,6 +14,7 @@ import {
|
||||||
SearchRowResponse,
|
SearchRowResponse,
|
||||||
SearchRowRequest,
|
SearchRowRequest,
|
||||||
SearchParams,
|
SearchParams,
|
||||||
|
GetRowResponse,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
import * as utils from "./utils"
|
import * as utils from "./utils"
|
||||||
import { gridSocket } from "../../../websockets"
|
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)
|
const tableId = utils.getTableId(ctx)
|
||||||
ctx.body = await quotas.addQuery(() => pickApi(tableId).find(ctx), {
|
ctx.body = await quotas.addQuery(() => pickApi(tableId).find(ctx), {
|
||||||
datasourceId: tableId,
|
datasourceId: tableId,
|
||||||
|
|
|
@ -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),
|
const tableId = utils.getTableId(ctx),
|
||||||
rowId = ctx.params.rowId
|
rowId = ctx.params.rowId
|
||||||
const table = await sdk.tables.getTable(tableId)
|
const table = await sdk.tables.getTable(tableId)
|
||||||
|
|
|
@ -27,7 +27,7 @@ validateJs.extend(validateJs.validators.datetime, {
|
||||||
|
|
||||||
export async function findRow(ctx: UserCtx, tableId: string, rowId: string) {
|
export async function findRow(ctx: UserCtx, tableId: string, rowId: string) {
|
||||||
const db = context.getAppDB()
|
const db = context.getAppDB()
|
||||||
let row
|
let row: Row
|
||||||
// TODO remove special user case in future
|
// TODO remove special user case in future
|
||||||
if (tableId === InternalTables.USER_METADATA) {
|
if (tableId === InternalTables.USER_METADATA) {
|
||||||
ctx.params = {
|
ctx.params = {
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import { Row } from "../../../documents/app/row"
|
import { Row } from "../../../documents/app/row"
|
||||||
|
|
||||||
|
export interface GetRowResponse extends Row {}
|
||||||
|
|
||||||
export interface DeleteRows {
|
export interface DeleteRows {
|
||||||
rows: (Row | string)[]
|
rows: (Row | string)[]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue