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

Loading…
Cancel
Save