From d82758f194b8d6b9b40694cf5dd5aeefc193cc96 Mon Sep 17 00:00:00 2001 From: mertmit Date: Tue, 12 Apr 2022 23:43:59 +0300 Subject: [PATCH] fix: update count api Signed-off-by: mertmit --- .../noco/meta/api/dataApis/dataAliasApis.ts | 4 +- scripts/sdk/swagger.json | 69 +++++++++++++++++++ 2 files changed, 71 insertions(+), 2 deletions(-) diff --git a/packages/nocodb/src/lib/noco/meta/api/dataApis/dataAliasApis.ts b/packages/nocodb/src/lib/noco/meta/api/dataApis/dataAliasApis.ts index 29f6f728bc..7f1c74438b 100644 --- a/packages/nocodb/src/lib/noco/meta/api/dataApis/dataAliasApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/dataApis/dataAliasApis.ts @@ -14,7 +14,7 @@ async function dataList(req: Request, res: Response) { } async function dataCount(req: Request, res: Response) { - const { model, view } = await getViewAndModelFromRequest(req); + const { model, view } = await getViewAndModelFromRequestByAliasOrId(req); const base = await Base.get(model.base_id); @@ -158,7 +158,7 @@ router.get( ncMetaAclMw(dataList, 'dataList') ); router.get( - '/data/:orgs/:projectName/:tableName/views/:viewName/count', + '/api/v1/db/data/:orgs/:projectName/:tableName/views/:viewName/count', ncMetaAclMw(dataCount, 'dataCount') ); diff --git a/scripts/sdk/swagger.json b/scripts/sdk/swagger.json index c2c121aa66..478dc5330a 100644 --- a/scripts/sdk/swagger.json +++ b/scripts/sdk/swagger.json @@ -2482,6 +2482,75 @@ } } }, + "/api/v1/db/data/{orgs}/{projectName}/{tableName}/views/{viewName}/count": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "orgs", + "in": "path", + "required": true + }, + { + "schema": { + "type": "string" + }, + "name": "projectName", + "in": "path", + "required": true + }, + { + "schema": { + "type": "string" + }, + "name": "tableName", + "in": "path", + "required": true + }, + { + "schema": { + "type": "string" + }, + "name": "viewName", + "in": "path", + "required": true + } + ], + "get": { + "summary": "", + "operationId": "db-view-row-count", + "description": "", + "tags": [ + "DB View Row" + ], + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "where" + }, + { + "schema": {}, + "in": "query", + "name": "nested", + "description": "Query params for nested data" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": {} + } + } + } + } + } + }, "/api/v1/db/data/{orgs}/{projectName}/{tableName}/views/{viewName}/{rowId}": { "parameters": [ {