adminforth 1.3.3 → 1.3.4
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.
package/dataConnectors/mongo.ts
CHANGED
|
@@ -107,8 +107,7 @@ class MongoConnector extends AdminForthBaseConnector implements IAdminForthDataS
|
|
|
107
107
|
return value;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
async genQuery({
|
|
111
|
-
const collection = this.db.db().collection(resource.table);
|
|
110
|
+
async genQuery({ filters }) {
|
|
112
111
|
const query = {};
|
|
113
112
|
for (const filter of filters) {
|
|
114
113
|
query[filter.field] = this.OperatorsMap[filter.operator](filter.value);
|
|
@@ -130,7 +129,7 @@ class MongoConnector extends AdminForthBaseConnector implements IAdminForthDataS
|
|
|
130
129
|
const tableName = resource.table;
|
|
131
130
|
|
|
132
131
|
const collection = this.db.db().collection(tableName);
|
|
133
|
-
const query = this.genQuery({
|
|
132
|
+
const query = await this.genQuery({ filters });
|
|
134
133
|
|
|
135
134
|
const sortArray: any[] = sort.map((s) => {
|
|
136
135
|
return [s.field, this.SortDirectionsMap[s.direction]];
|
|
@@ -109,8 +109,7 @@ class MongoConnector extends AdminForthBaseConnector {
|
|
|
109
109
|
return value;
|
|
110
110
|
}
|
|
111
111
|
genQuery(_a) {
|
|
112
|
-
return __awaiter(this, arguments, void 0, function* ({
|
|
113
|
-
const collection = this.db.db().collection(resource.table);
|
|
112
|
+
return __awaiter(this, arguments, void 0, function* ({ filters }) {
|
|
114
113
|
const query = {};
|
|
115
114
|
for (const filter of filters) {
|
|
116
115
|
query[filter.field] = this.OperatorsMap[filter.operator](filter.value);
|
|
@@ -123,7 +122,7 @@ class MongoConnector extends AdminForthBaseConnector {
|
|
|
123
122
|
// const columns = resource.dataSourceColumns.filter(c=> !c.virtual).map((col) => col.name).join(', ');
|
|
124
123
|
const tableName = resource.table;
|
|
125
124
|
const collection = this.db.db().collection(tableName);
|
|
126
|
-
const query = this.genQuery({
|
|
125
|
+
const query = yield this.genQuery({ filters });
|
|
127
126
|
const sortArray = sort.map((s) => {
|
|
128
127
|
return [s.field, this.SortDirectionsMap[s.direction]];
|
|
129
128
|
});
|