From 9779ae38308d124971ba85b01a875bf7e83c2e08 Mon Sep 17 00:00:00 2001 From: flisowna Date: Mon, 5 Dec 2022 18:50:18 +0300 Subject: [PATCH] WIP select for barcode format --- .../nocodb/src/lib/migrations/v2/nc_023_barcode_column_type.ts | 1 + packages/nocodb/src/lib/models/BarcodeColumn.ts | 3 +++ packages/nocodb/src/lib/models/Column.ts | 1 + 3 files changed, 5 insertions(+) diff --git a/packages/nocodb/src/lib/migrations/v2/nc_023_barcode_column_type.ts b/packages/nocodb/src/lib/migrations/v2/nc_023_barcode_column_type.ts index e67f31a12e..f6c153ba8c 100644 --- a/packages/nocodb/src/lib/migrations/v2/nc_023_barcode_column_type.ts +++ b/packages/nocodb/src/lib/migrations/v2/nc_023_barcode_column_type.ts @@ -13,6 +13,7 @@ const up = async (knex: Knex) => { .foreign('fk_barcode_value_column_id') .references(`${MetaTable.COLUMNS}.id`); + table.string('barcode_format', 15); table.boolean('deleted'); table.float('order'); table.timestamps(true, true); diff --git a/packages/nocodb/src/lib/models/BarcodeColumn.ts b/packages/nocodb/src/lib/models/BarcodeColumn.ts index 83f90faaf2..60c4d6bd02 100644 --- a/packages/nocodb/src/lib/models/BarcodeColumn.ts +++ b/packages/nocodb/src/lib/models/BarcodeColumn.ts @@ -6,6 +6,7 @@ import { extractProps } from '../meta/helpers/extractProps'; export default class BarcodeColumn { fk_column_id: string; fk_barcode_value_column_id: string; + barcode_format: string; constructor(data: Partial) { Object.assign(this, data); @@ -18,6 +19,7 @@ export default class BarcodeColumn { await ncMeta.metaInsert2(null, null, MetaTable.COL_BARCODE, { fk_column_id: data.fk_column_id, fk_barcode_value_column_id: data.fk_barcode_value_column_id, + barcode_format: data.barcode_format, }); return this.read(data.fk_column_id, ncMeta); @@ -52,6 +54,7 @@ export default class BarcodeColumn { const updateObj = extractProps(barcode, [ 'fk_column_id', 'fk_barcode_value_column_id', + 'barcode_format', ]); // get existing cache const key = `${CacheScope.COL_BARCODE}:${id}`; diff --git a/packages/nocodb/src/lib/models/Column.ts b/packages/nocodb/src/lib/models/Column.ts index 8a3ae56593..ad578fd261 100644 --- a/packages/nocodb/src/lib/models/Column.ts +++ b/packages/nocodb/src/lib/models/Column.ts @@ -240,6 +240,7 @@ export default class Column implements ColumnType { { fk_column_id: colId, fk_barcode_value_column_id: column.fk_barcode_value_column_id, + barcode_format: column.barcode_format, }, ncMeta );