Browse Source

refactor: column update api corrections

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/1668/head
Pranav C 3 years ago
parent
commit
b26cf35dea
  1. 2
      packages/nc-gui/components/project/spreadsheet/components/editColumn.vue
  2. 2
      packages/nc-gui/components/project/spreadsheet/components/editVirtualColumn.vue
  3. 4
      packages/nocodb/src/lib/noco/meta/api/columnApis.ts

2
packages/nc-gui/components/project/spreadsheet/components/editColumn.vue

@ -565,7 +565,7 @@ export default {
this.newColumn.title = this.newColumn.column_name this.newColumn.title = this.newColumn.column_name
if (this.editColumn) { if (this.editColumn) {
await this.$api.dbTableColumn.update(this.meta.id, this.column.id, this.newColumn) await this.$api.dbTableColumn.update(this.column.id, this.newColumn)
} else { } else {
await this.$api.dbTableColumn.create(this.meta.id, this.newColumn) await this.$api.dbTableColumn.create(this.meta.id, this.newColumn)
} }

2
packages/nc-gui/components/project/spreadsheet/components/editVirtualColumn.vue

@ -113,7 +113,7 @@ export default {
async save() { async save() {
// todo: rollup update // todo: rollup update
try { try {
await this.$api.dbTableColumn.update(this.meta.id, this.column.id, this.newColumn) await this.$api.dbTableColumn.update(this.column.id, this.newColumn)
} catch (e) { } catch (e) {
console.log(this._extractSdkResponseErrorMsg(e)) console.log(this._extractSdkResponseErrorMsg(e))
this.$toast.error('Failed to update column alias').goAway(3000) this.$toast.error('Failed to update column alias').goAway(3000)

4
packages/nocodb/src/lib/noco/meta/api/columnApis.ts

@ -514,7 +514,7 @@ export async function columnUpdate(req: Request, res: Response<TableType>) {
!isVirtualCol(req.body) && !isVirtualCol(req.body) &&
!(await Column.checkTitleAvailable({ !(await Column.checkTitleAvailable({
column_name: req.body.column_name, column_name: req.body.column_name,
fk_model_id: req.params.tableId, fk_model_id: column.fk_model_id,
exclude_id: req.params.columnId exclude_id: req.params.columnId
})) }))
) { ) {
@ -523,7 +523,7 @@ export async function columnUpdate(req: Request, res: Response<TableType>) {
if ( if (
!(await Column.checkAliasAvailable({ !(await Column.checkAliasAvailable({
title: req.body.title, title: req.body.title,
fk_model_id: req.params.tableId, fk_model_id: column.fk_model_id,
exclude_id: req.params.columnId exclude_id: req.params.columnId
})) }))
) { ) {

Loading…
Cancel
Save