Type search request
This commit is contained in:
parent
a91ce15c9b
commit
cb59a2fc9b
|
@ -11,6 +11,9 @@ import {
|
|||
Row,
|
||||
PatchRowRequest,
|
||||
PatchRowResponse,
|
||||
SearchRowResponse,
|
||||
SearchRowRequest,
|
||||
SearchParams,
|
||||
} from "@budibase/types"
|
||||
import * as utils from "./utils"
|
||||
import { gridSocket } from "../../../websockets"
|
||||
|
@ -197,10 +200,10 @@ export async function destroy(ctx: UserCtx<DeleteRowRequest>) {
|
|||
ctx.body = response
|
||||
}
|
||||
|
||||
export async function search(ctx: any) {
|
||||
export async function search(ctx: Ctx<SearchRowRequest, SearchRowResponse>) {
|
||||
const tableId = utils.getTableId(ctx)
|
||||
|
||||
const searchParams = {
|
||||
const searchParams: SearchParams = {
|
||||
...ctx.request.body,
|
||||
tableId,
|
||||
}
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import { quotas } from "@budibase/pro"
|
||||
import {
|
||||
UserCtx,
|
||||
SearchResponse,
|
||||
SearchRowResponse,
|
||||
SortOrder,
|
||||
SortType,
|
||||
ViewV2,
|
||||
} from "@budibase/types"
|
||||
import sdk from "../../../sdk"
|
||||
|
||||
export async function searchView(ctx: UserCtx<void, SearchResponse>) {
|
||||
export async function searchView(ctx: UserCtx<void, SearchRowResponse>) {
|
||||
const { viewId } = ctx.params
|
||||
|
||||
const view = await sdk.views.get(viewId)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { SearchParams } from "../../../sdk"
|
||||
import { Row } from "../../../documents"
|
||||
|
||||
export interface PatchRowRequest extends Row {
|
||||
|
@ -8,6 +9,8 @@ export interface PatchRowRequest extends Row {
|
|||
|
||||
export interface PatchRowResponse extends Row {}
|
||||
|
||||
export interface SearchResponse {
|
||||
export interface SearchRowRequest extends SearchParams {}
|
||||
|
||||
export interface SearchRowResponse {
|
||||
rows: any[]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue