diff --git a/packages/nc-gui/components/project/spreadsheet/public/xcForm.vue b/packages/nc-gui/components/project/spreadsheet/public/xcForm.vue index 1247a6b086..73d9929a68 100644 --- a/packages/nc-gui/components/project/spreadsheet/public/xcForm.vue +++ b/packages/nc-gui/components/project/spreadsheet/public/xcForm.vue @@ -298,7 +298,7 @@ export default { this.loading = true try { this.viewMeta = (await this.$api.public.sharedViewMetaGet(this.$route.params.id, { - password: this.password + headers: { 'xc-password': this.password } })) this.view = this.viewMeta.view @@ -306,66 +306,6 @@ export default { this.metas = this.viewMeta.relatedMetas this.columns = this.meta.columns.filter(c => c.show) this.client = this.viewMeta.client - // try { - // // eslint-disable-next-line camelcase - // const { - // meta, - // // model_name, - // client, - // query_params: qp, - // db_alias: dbAlias, - // relatedTableMetas - // } = await this.$store.dispatch('sqlMgr/ActSqlOp', [null, 'sharedViewGet', { - // view_id: this.$route.params.id, - // password: this.password - // }]) - // this.client = client - // this.meta = meta - // this.query_params = qp - // this.dbAlias = dbAlias - // this.metas = relatedTableMetas - // - // const showFields = this.query_params.showFields || {} - // let fields = this.query_params.fieldsOrder || [] - // if (!fields.length) { - // fields = Object.keys(showFields) - // } - // // eslint-disable-next-line camelcase - // - // let columns = this.meta.columns - // if (this.meta && this.meta.v) { - // columns = [...columns, ...this.meta.v.map(v => ({ ...v, virtual: 1 }))] - // } - // - // { - // const _ref = {} - // columns.forEach((c) => { - // if (c.virtual && c.bt) { - // c.prop = `${c.bt.rtn}Read` - // } - // if (c.virtual && c.mm) { - // c.prop = `${c.mm.rtn}MMList` - // } - // if (c.virtual && c.hm) { - // c.prop = `${c.hm.table_name}List` - // } - // - // // if (c.virtual && c.lk) { - // // c.alias = `${c.lk._lcn} (from ${c.lk._ltn})` - // // } else { - // c.alias = c.title - // // } - // if (c.alias in _ref) { - // c.alias += _ref[c.alias]++ - // } else { - // _ref[c.alias] = 1 - // } - // }) - // } - // // this.modelName = model_name - // this.columns = columns.filter(c => showFields[c.alias]).sort((a, b) => fields.indexOf(a.alias) - fields.indexOf(b.alias)) - // - // this.localParams = (this.query_params.extraViewParams && this.query_params.extraViewParams.formParams) || {} } catch (e) { if (e.response && e.response.status === 404) { this.notFound = true @@ -385,16 +325,6 @@ export default { } this.submitting = true - // const id = this.meta.columns.filter(c => c.pk).map(c => this.localState[c.title]).join('___') - - // const updatedObj = Object.keys(this.changedColumns).reduce((obj, col) => { - // obj[col] = this.localState[col] - // return obj - // }, {}) - - // if (this.isNew) { - - // const formData = new FormData() const data = { ...this.localState, ...this.virtual } const attachment = {} @@ -407,8 +337,9 @@ export default { await this.$api.public.dataCreate(this.$route.params.id, { data, - password: this.password, ...attachment + }, { + headers: { 'xc-password': this.password } }) this.virtual = {} diff --git a/packages/nc-gui/components/project/spreadsheet/public/xcTable.vue b/packages/nc-gui/components/project/spreadsheet/public/xcTable.vue index 5e16438a9b..f418652b6a 100644 --- a/packages/nc-gui/components/project/spreadsheet/public/xcTable.vue +++ b/packages/nc-gui/components/project/spreadsheet/public/xcTable.vue @@ -430,7 +430,7 @@ export default { filterArrJson: JSON.stringify(this.filters), ...this.queryParams }, { - headers: { password: this.password } + headers: { 'xc-password': this.password } } )) diff --git a/packages/nocodb-sdk/src/lib/Api.ts b/packages/nocodb-sdk/src/lib/Api.ts index eeed576ac6..9fbcf09dc1 100644 --- a/packages/nocodb-sdk/src/lib/Api.ts +++ b/packages/nocodb-sdk/src/lib/Api.ts @@ -2821,7 +2821,6 @@ export class Api< */ dataList: ( sharedViewUuid: string, - data: { password?: string; sorts?: SortType[]; filters?: FilterType[] }, query?: { limit?: string; offset?: string }, params: RequestParams = {} ) => @@ -2829,8 +2828,6 @@ export class Api< path: `/api/v1/db/public/shared-view/${sharedViewUuid}/rows`, method: 'GET', query: query, - body: data, - type: ContentType.Json, format: 'json', ...params, }), @@ -2839,14 +2836,20 @@ export class Api< * No description * * @tags Public - * @name SharedViewCreate + * @name DataCreate * @request POST:/api/v1/db/public/shared-view/{sharedViewUuid}/rows * @response `200` `any` OK */ - sharedViewCreate: (sharedViewUuid: string, params: RequestParams = {}) => + dataCreate: ( + sharedViewUuid: string, + data: any, + params: RequestParams = {} + ) => this.request({ path: `/api/v1/db/public/shared-view/${sharedViewUuid}/rows`, method: 'POST', + body: data, + type: ContentType.Json, format: 'json', ...params, }), diff --git a/packages/nocodb/src/lib/noco/meta/api/publicApis/publicDataApis.ts b/packages/nocodb/src/lib/noco/meta/api/publicApis/publicDataApis.ts index 69fc83a5b8..17de3870c9 100644 --- a/packages/nocodb/src/lib/noco/meta/api/publicApis/publicDataApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/publicApis/publicDataApis.ts @@ -324,7 +324,7 @@ router.post( catchError(relDataList) ); router.post( - '/api/v1/db/public/shared-view/:sharedViewUuid/create', + '/api/v1/db/public/shared-view/:sharedViewUuid/rows', multer({ storage: multer.diskStorage({}) }).any(), diff --git a/scripts/sdk/swagger.json b/scripts/sdk/swagger.json index 2344a910a7..e7f613b81a 100644 --- a/scripts/sdk/swagger.json +++ b/scripts/sdk/swagger.json @@ -3421,33 +3421,6 @@ "tags": [ "Public" ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "password": { - "type": "string" - }, - "sorts": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Sort" - } - }, - "filters": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Filter" - } - } - } - } - } - }, - "description": "" - }, "parameters": [ { "schema": { @@ -3467,7 +3440,7 @@ }, "post": { "summary": "", - "operationId": "public-shared-view-create", + "operationId": "public-data-create", "responses": { "200": { "description": "OK", @@ -3478,6 +3451,13 @@ } } }, + "requestBody": { + "content": { + "application/json": { + "schema": {} + } + } + }, "tags": [ "Public" ],