Browse Source

refactor(nocodb): remove unused isXcdbBase

pull/5505/head
Wing-Kam Wong 2 years ago
parent
commit
478d7c19f4
  1. 21
      packages/nocodb/src/db/BaseModelSqlv2.ts

21
packages/nocodb/src/db/BaseModelSqlv2.ts

@ -1998,11 +1998,6 @@ class BaseModelSqlv2 {
}; };
} }
private async isXcdbBase() {
const base = await Base.get(this.model.base_id);
return base.is_meta;
}
get isSqlite() { get isSqlite() {
return this.clientType === 'sqlite3'; return this.clientType === 'sqlite3';
} }
@ -3267,8 +3262,7 @@ class BaseModelSqlv2 {
data = this.convertAttachmentType(data, childTable); data = this.convertAttachmentType(data, childTable);
// update date time fields // update date time fields
const isXcdbBase = await this.isXcdbBase(); data = this.convertDateFormat(data, childTable);
data = this.convertDateFormat(data, isXcdbBase, childTable);
return data; return data;
} }
@ -3312,7 +3306,6 @@ class BaseModelSqlv2 {
private _convertDateFormat( private _convertDateFormat(
dateTimeColumns: Record<string, any>[], dateTimeColumns: Record<string, any>[],
d: Record<string, any>, d: Record<string, any>,
isXcdbBase: BoolType,
) { ) {
if (!d) return d; if (!d) return d;
for (const col of dateTimeColumns) { for (const col of dateTimeColumns) {
@ -3368,11 +3361,7 @@ class BaseModelSqlv2 {
return d; return d;
} }
private convertDateFormat( private convertDateFormat(data: Record<string, any>, childTable?: Model) {
data: Record<string, any>,
isXcdbBase: BoolType,
childTable?: Model,
) {
// Show the date time in UTC format in API response // Show the date time in UTC format in API response
// e.g. 2022-01-01 04:30:00+00:00 // e.g. 2022-01-01 04:30:00+00:00
if (data) { if (data) {
@ -3381,11 +3370,9 @@ class BaseModelSqlv2 {
).filter((c) => c.uidt === UITypes.DateTime); ).filter((c) => c.uidt === UITypes.DateTime);
if (dateTimeColumns.length) { if (dateTimeColumns.length) {
if (Array.isArray(data)) { if (Array.isArray(data)) {
data = data.map((d) => data = data.map((d) => this._convertDateFormat(dateTimeColumns, d));
this._convertDateFormat(dateTimeColumns, d, isXcdbBase),
);
} else { } else {
this._convertDateFormat(dateTimeColumns, data, isXcdbBase); this._convertDateFormat(dateTimeColumns, data);
} }
} }
} }

Loading…
Cancel
Save