ismx-nexo-node-app 0.3.40 → 0.3.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -146,7 +146,7 @@ class RepositoryDatabasePostgres extends RepositoryDatabase_1.default {
|
|
|
146
146
|
let schema = this.tables[tableName][0].schema;
|
|
147
147
|
let { where, values } = this.toWhere(tableName, filters);
|
|
148
148
|
let query = `SELECT count(*) as count FROM ${schema}.${tableName} WHERE ${where}`;
|
|
149
|
-
return this.query(query, values).then((result) => result[0].count);
|
|
149
|
+
return this.query(query, values).then((result) => { var _a, _b; return (_b = (_a = result[0]) === null || _a === void 0 ? void 0 : _a.count) !== null && _b !== void 0 ? _b : 0; });
|
|
150
150
|
});
|
|
151
151
|
}
|
|
152
152
|
select(tableName_1, select_1) {
|
|
@@ -156,7 +156,7 @@ class RepositoryDatabasePostgres extends RepositoryDatabase_1.default {
|
|
|
156
156
|
let schema = this.tables[tableName][0].schema;
|
|
157
157
|
let { where, values } = this.toWhere(tableName, filters);
|
|
158
158
|
let query = `SELECT json_agg(u.${select}) as list FROM ${schema}.${tableName} u WHERE ${where}`;
|
|
159
|
-
return this.query(query, values).then((result) => result[0].list);
|
|
159
|
+
return this.query(query, values).then((result) => { var _a, _b; return (_b = (_a = result[0]) === null || _a === void 0 ? void 0 : _a.list) !== null && _b !== void 0 ? _b : []; });
|
|
160
160
|
});
|
|
161
161
|
}
|
|
162
162
|
del(tableName, id) {
|
package/package.json
CHANGED
|
@@ -147,7 +147,7 @@ export default class RepositoryDatabasePostgres extends RepositoryDatabase
|
|
|
147
147
|
let schema = this.tables[tableName][0].schema;
|
|
148
148
|
let { where, values } = this.toWhere(tableName, filters);
|
|
149
149
|
let query = `SELECT count(*) as count FROM ${schema}.${tableName} WHERE ${where}`
|
|
150
|
-
return this.query<{count:number}>(query, values).then((result) => result[0]
|
|
150
|
+
return this.query<{count:number}>(query, values).then((result) => result[0]?.count ?? 0);
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
async select(tableName: string, select: string, filters: { [key: string]: Primitive | Array<Primitive> }={}): Promise<string[]>
|
|
@@ -156,7 +156,7 @@ export default class RepositoryDatabasePostgres extends RepositoryDatabase
|
|
|
156
156
|
let schema = this.tables[tableName][0].schema;
|
|
157
157
|
let { where, values } = this.toWhere(tableName, filters);
|
|
158
158
|
let query = `SELECT json_agg(u.${select}) as list FROM ${schema}.${tableName} u WHERE ${where}`
|
|
159
|
-
return this.query<{list:string[]}>(query, values).then((result) => result[0]
|
|
159
|
+
return this.query<{list:string[]}>(query, values).then((result) => result[0]?.list ?? []);
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
async del<T>(tableName: string, id: string): Promise<T>
|