Browse Source

Merge branch 'develop' into chore/add-ukrainian-readme

pull/7433/head
AlexHladin 12 months ago
parent
commit
2a5164f94d
  1. 23
      packages/nocodb/src/models/BarcodeColumn.ts
  2. 21
      packages/nocodb/src/models/QrCodeColumn.ts

23
packages/nocodb/src/models/BarcodeColumn.ts

@ -27,6 +27,7 @@ export default class BarcodeColumn {
return this.read(barcodeColumn.fk_column_id, ncMeta); return this.read(barcodeColumn.fk_column_id, ncMeta);
} }
public static async read(columnId: string, ncMeta = Noco.ncMeta) { public static async read(columnId: string, ncMeta = Noco.ncMeta) {
let column = let column =
columnId && columnId &&
@ -47,28 +48,6 @@ export default class BarcodeColumn {
return column ? new BarcodeColumn(column) : null; return column ? new BarcodeColumn(column) : null;
} }
static async update(
id: string,
barcode: Partial<BarcodeColumn>,
ncMeta = Noco.ncMeta,
) {
const updateObj = extractProps(barcode, [
'fk_column_id',
'fk_barcode_value_column_id',
'barcode_format',
]);
// get existing cache
const key = `${CacheScope.COL_BARCODE}:${id}`;
let o = await NocoCache.get(key, CacheGetType.TYPE_OBJECT);
if (o) {
o = { ...o, ...updateObj };
// set cache
await NocoCache.set(key, o);
}
// set meta
await ncMeta.metaUpdate(null, null, MetaTable.COL_BARCODE, updateObj, id);
}
async getValueColumn() { async getValueColumn() {
return Column.get({ return Column.get({
colId: this.fk_barcode_value_column_id, colId: this.fk_barcode_value_column_id,

21
packages/nocodb/src/models/QrCodeColumn.ts

@ -47,27 +47,6 @@ export default class QrCodeColumn {
id: string; id: string;
static async update(
id: string,
qrCode: Partial<QrCodeColumn>,
ncMeta = Noco.ncMeta,
) {
const updateObj = extractProps(qrCode, [
'fk_column_id',
'fk_qr_value_column_id',
]);
// get existing cache
const key = `${CacheScope.COL_QRCODE}:${id}`;
let o = await NocoCache.get(key, CacheGetType.TYPE_OBJECT);
if (o) {
o = { ...o, ...updateObj };
// set cache
await NocoCache.set(key, o);
}
// set meta
await ncMeta.metaUpdate(null, null, MetaTable.COL_QRCODE, updateObj, id);
}
async getValueColumn() { async getValueColumn() {
return Column.get({ return Column.get({
colId: this.fk_qr_value_column_id, colId: this.fk_qr_value_column_id,

Loading…
Cancel
Save