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
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 {
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() {
// todo: rollup update
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) {
console.log(this._extractSdkResponseErrorMsg(e))
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) &&
!(await Column.checkTitleAvailable({
column_name: req.body.column_name,
fk_model_id: req.params.tableId,
fk_model_id: column.fk_model_id,
exclude_id: req.params.columnId
}))
) {
@ -523,7 +523,7 @@ export async function columnUpdate(req: Request, res: Response<TableType>) {
if (
!(await Column.checkAliasAvailable({
title: req.body.title,
fk_model_id: req.params.tableId,
fk_model_id: column.fk_model_id,
exclude_id: req.params.columnId
}))
) {

Loading…
Cancel
Save