Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

fix: move bulk group by aggreration api outside ee

Ramesh Mane3382a33adb0f
diff --git a/packages/nocodb/src/controllers/public-datas.controller.ts b/packages/nocodb/src/controllers/public-datas.controller.ts
index 7a9d1a04d1..4026c5741c 100644
--- a/packages/nocodb/src/controllers/public-datas.controller.ts
+++ b/packages/nocodb/src/controllers/public-datas.controller.ts
@@ -280,6 +280,25 @@ export class PublicDatasController {
return response;
}
+ @Post([
+ '/api/v1/db/public/shared-view/:sharedViewUuid/bulk/aggregate',
+ '/api/v2/public/shared-view/:sharedViewUuid/bulk/aggregate',
+ ])
+ async bulkDataAggregate(
+ @TenantContext() context: NcContext,
+ @Req() req: NcRequest,
+ @Param('sharedViewUuid') sharedViewUuid: string,
+ ) {
+ const response = await this.publicDatasService.bulkAggregate(context, {
+ query: req.query,
+ password: req.headers?.['xc-password'] as string,
+ sharedViewUuid,
+ body: req.body,
+ });
+
+ return response;
+ }
+
@Post(['/api/v2/public/shared-view/:sharedViewUuid/bulk/group'])
async bulkGroupBy(
@TenantContext() context: NcContext,
diff --git a/packages/nocodb/src/schema/swagger.json b/packages/nocodb/src/schema/swagger.json
index f11021c993..a693ad2fcc 100644
--- a/packages/nocodb/src/schema/swagger.json
+++ b/packages/nocodb/src/schema/swagger.json
@@ -13923,6 +13923,215 @@
}
}
},
+ "/api/v2/tables/{tableId}/bulk/aggregate": {
+ "parameters": [
+ {
+ "schema": {
+ "type": "string"
+ },
+ "name": "tableId",
+ "in": "path",
+ "required": true,
+ "description": "Table ID"
+ },
+ {
+ "schema": {
+ "type": "string"
+ },
+ "required": true,
+ "name": "viewId",
+ "in": "query",
+ "description": "View ID is required"
+ },
+ {
+ "schema": {
+ "type": "array",
+ "description": "List of fields to be aggregated",
+ "items": {
+ "type": "object"
+ }
+ },
+ "in": "query",
+ "name": "aggregation",
+ "description": "Used for selective aggregation"
+ }
+ ],
+ "post": {
+ "summary": "Read Bulk Aggregated Data",
+ "operationId": "db-data-table-bulk-aggregate",
+ "description": "Read bulk aggregated data from a given table with given filters",
+ "tags": [
+ "DB Data Table Bulk Aggregate"
+ ],
+ "parameters": [
+ {
+ "schema": {
+ "type": "string"
+ },
+ "in": "query",
+ "name": "where",
+ "description": "Extra filtering"
+ },
+ {
+ "schema": {
+ "type": "string"
+ },
+ "in": "query",
+ "name": "filterArrJson",
+ "description": "Used for multiple filter queries"
+ },
+ {
+ "$ref": "#/components/parameters/xc-auth"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "object"
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object"
+ },
+ "examples": {
+ "Example 1": {
+ "value": {
+ "alias": {
+ "Id": 1,
+ "Title": "90",
+ "SingleSelect": "50"
+ },
+ "alias2": {
+ "Id": 2,
+ "Title": "50",
+ "SingleSelect": "30"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "400": {
+ "$ref": "#/components/responses/BadRequest"
+ }
+ }
+ }
+ },
+ "/api/v2/public/shared-view/{sharedViewUuid}/bulk/aggregate": {
+ "parameters": [
+ {
+ "schema": {
+ "type": "string",
+ "example": "24a6d0bb-e45d-4b1a-bfef-f492d870de9f"
+ },
+ "name": "sharedViewUuid",
+ "in": "path",
+ "required": true,
+ "description": "Shared View UUID"
+ },
+ {
+ "schema": {
+ "type": "string"
+ },
+ "in": "header",
+ "name": "xc-password",
+ "description": "Shared view password"
+ }
+ ],
+ "post": {
+ "summary": "Read Shared View Bulk Aggregated Data",
+ "operationId": "public-data-table-bulk-aggregate",
+ "description": "Read bulk aggregated data from a given table with provided filters",
+ "tags": [
+ "Public"
+ ],
+ "parameters": [
+ {
+ "schema": {
+ "type": "string"
+ },
+ "in": "query",
+ "name": "where",
+ "description": "Extra filtering"
+ },
+ {
+ "schema": {
+ "type": "string"
+ },
+ "in": "query",
+ "name": "filterArrJson",
+ "description": "Used for multiple filter queries"
+ },
+ {
+ "schema": {
+ "type": "array",
+ "description": "List of fields to be aggregated",
+ "items": {
+ "type": "object"
+ }
+ },
+ "in": "query",
+ "name": "aggregation",
+ "description": "Used for selective aggregation"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "object"
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object"
+ },
+ "examples": {
+ "Example 1": {
+ "value": {
+ "alias": {
+ "Id": 1,
+ "Title": "90",
+ "SingleSelect": "50"
+ },
+ "alias2": {
+ "Id": 2,
+ "Title": "50",
+ "SingleSelect": "30"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "400": {
+ "$ref": "#/components/responses/BadRequest"
+ }
+ }
+ }
+ },
"/api/v2/public/shared-view/{sharedViewUuid}/downloadAttachment/{columnId}/{rowId}": {
"parameters": [
{