Type patch

This commit is contained in:
Adria Navarro 2023-07-26 12:20:06 +02:00
parent b69e18ab70
commit f6e6243c81
2 changed files with 12 additions and 3 deletions

View File

@ -9,10 +9,11 @@ import {
DeleteRow, DeleteRow,
DeleteRows, DeleteRows,
Row, Row,
PatchRowRequest,
PatchRowResponse,
SearchResponse, SearchResponse,
SortOrder, SortOrder,
SortType, SortType,
UserCtx,
ViewV2, ViewV2,
} from "@budibase/types" } from "@budibase/types"
import * as utils from "./utils" import * as utils from "./utils"
@ -30,7 +31,9 @@ function pickApi(tableId: any) {
return internal return internal
} }
export async function patch(ctx: UserCtx): Promise<any> { export async function patch(
ctx: UserCtx<PatchRowRequest, PatchRowResponse>
): Promise<any> {
const appId = ctx.appId const appId = ctx.appId
const tableId = utils.getTableId(ctx) const tableId = utils.getTableId(ctx)
const body = ctx.request.body const body = ctx.request.body
@ -39,7 +42,7 @@ export async function patch(ctx: UserCtx): Promise<any> {
return save(ctx) return save(ctx)
} }
try { try {
const { row, table } = await quotas.addQuery<any>( const { row, table } = await quotas.addQuery(
() => pickApi(tableId).patch(ctx), () => pickApi(tableId).patch(ctx),
{ {
datasourceId: tableId, datasourceId: tableId,

View File

@ -1,3 +1,9 @@
import { Row } from "../../../documents"
export interface PatchRowRequest extends Row {}
export interface PatchRowResponse extends Row {}
export interface SearchResponse { export interface SearchResponse {
rows: any[] rows: any[]
} }