Adding countRows to search validators.

This commit is contained in:
mike12345567 2024-06-18 11:16:21 +01:00
parent 75bf3c78e6
commit 73013332ae
4 changed files with 5 additions and 2 deletions

View File

@ -60,7 +60,7 @@ export async function searchView(
user: sdk.users.getUserContextBindings(ctx.user), user: sdk.users.getUserContextBindings(ctx.user),
}) })
const searchOptions: RequiredKeys<Omit<SearchViewRowRequest, "countRows">> & const searchOptions: RequiredKeys<SearchViewRowRequest> &
RequiredKeys<Pick<RowSearchParams, "tableId" | "query" | "fields">> = { RequiredKeys<Pick<RowSearchParams, "tableId" | "query" | "fields">> = {
tableId: view.tableId, tableId: view.tableId,
query: enrichedQuery, query: enrichedQuery,
@ -69,6 +69,7 @@ export async function searchView(
limit: body.limit, limit: body.limit,
bookmark: body.bookmark, bookmark: body.bookmark,
paginate: body.paginate, paginate: body.paginate,
countRows: body.countRows,
} }
const result = await sdk.rows.search(searchOptions) const result = await sdk.rows.search(searchOptions)

View File

@ -86,6 +86,7 @@ router
router.post( router.post(
"/api/v2/views/:viewId/search", "/api/v2/views/:viewId/search",
internalSearchValidator(),
authorizedResource(PermissionType.VIEW, PermissionLevel.READ, "viewId"), authorizedResource(PermissionType.VIEW, PermissionLevel.READ, "viewId"),
rowController.views.searchView rowController.views.searchView
) )

View File

@ -109,6 +109,7 @@ export function internalSearchValidator() {
sortOrder: OPTIONAL_STRING, sortOrder: OPTIONAL_STRING,
sortType: OPTIONAL_STRING, sortType: OPTIONAL_STRING,
paginate: Joi.boolean(), paginate: Joi.boolean(),
countRows: Joi.boolean(),
bookmark: Joi.alternatives() bookmark: Joi.alternatives()
.try(OPTIONAL_STRING, OPTIONAL_NUMBER) .try(OPTIONAL_STRING, OPTIONAL_NUMBER)
.optional(), .optional(),

View File

@ -21102,7 +21102,7 @@ tar@6.1.15:
mkdirp "^1.0.3" mkdirp "^1.0.3"
yallist "^4.0.0" yallist "^4.0.0"
tar@^6.1.11, tar@^6.1.2: tar@6.2.1, tar@^6.1.11, tar@^6.1.2:
version "6.2.1" version "6.2.1"
resolved "https://registry.yarnpkg.com/tar/-/tar-6.2.1.tgz#717549c541bc3c2af15751bea94b1dd068d4b03a" resolved "https://registry.yarnpkg.com/tar/-/tar-6.2.1.tgz#717549c541bc3c2af15751bea94b1dd068d4b03a"
integrity sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A== integrity sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==