Browse Source

refactor: shared view csv download api corrections

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/1668/head
Pranav C 3 years ago
parent
commit
5781953da5
  1. 5
      packages/nc-gui/components/project/spreadsheet/components/moreActions.vue
  2. 7
      packages/nocodb-sdk/src/lib/Api.ts
  3. 5
      packages/nocodb/src/lib/noco/meta/api/publicApis/publicDataExportApis.ts
  4. 30
      scripts/sdk/swagger.json

5
packages/nc-gui/components/project/spreadsheet/components/moreActions.vue

@ -237,10 +237,13 @@ export default {
while (!isNaN(offset) && offset > -1) {
let res
if (this.publicViewId) {
res = await this.$api.public.csvExport(this.publicViewId, ExportTypes.CSV, this.reqPayload, {
res = await this.$api.public.csvExport(this.publicViewId, ExportTypes.CSV, {
responseType: 'blob',
query: {
offset
},
headers: {
'xc-password': this.reqPayload && this.reqPayload.password
}
})
} else {

7
packages/nocodb-sdk/src/lib/Api.ts

@ -2948,20 +2948,17 @@ export class Api<
*
* @tags Public
* @name CsvExport
* @request POST:/api/v1/db/public/shared-view/{sharedViewUuid}/rows/export/{type}
* @request GET:/api/v1/db/public/shared-view/{sharedViewUuid}/rows/export/{type}
* @response `200` `any` OK
*/
csvExport: (
sharedViewUuid: string,
type: 'csv' | 'excel',
data: { password?: string; filters?: FilterType[]; sorts?: SortType[] },
params: RequestParams = {}
) =>
this.request<any, any>({
path: `/api/v1/db/public/shared-view/${sharedViewUuid}/rows/export/${type}`,
method: 'POST',
body: data,
type: ContentType.Json,
method: 'GET',
wrapped: true,
...params,
}),

5
packages/nocodb/src/lib/noco/meta/api/publicApis/publicDataExportApis.ts

@ -188,5 +188,8 @@ async function serializeCellValue({
}
const router = Router({ mergeParams: true });
router.post('/public/data/:publicDataUuid/export/csv', catchError(exportCsv));
router.get(
'/api/v1/db/public/shared-view/:publicDataUuid/rows/export/csv',
catchError(exportCsv)
);
export default router;

30
scripts/sdk/swagger.json

@ -3642,7 +3642,7 @@
"required": true
}
],
"post": {
"get": {
"summary": "",
"operationId": "public-csv-export",
"description": "",
@ -3666,33 +3666,7 @@
},
"tags": [
"Public"
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"password": {
"type": "string"
},
"filters": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Filter"
}
},
"sorts": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Sort"
}
}
}
}
}
}
}
]
}
},
"/api/v1/db/public/shared-view/{sharedViewUuid}/nested/{columnName}": {

Loading…
Cancel
Save