multi-db-orm 1.2.1 → 1.3.0
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/engines/firestoredb.js
CHANGED
|
@@ -18,16 +18,22 @@ class FireStoreDB extends MultiDbORM {
|
|
|
18
18
|
|
|
19
19
|
admin
|
|
20
20
|
serviceAccount
|
|
21
|
-
constructor(serviceAccount) {
|
|
21
|
+
constructor(serviceAccount,appname) {
|
|
22
22
|
super()
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
var admin = require('firebase-admin');
|
|
25
25
|
this.serviceAccount = serviceAccount;
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
if(appname){
|
|
28
|
+
admin = admin.initializeApp({
|
|
29
|
+
credential: admin.credential.cert(this.serviceAccount),
|
|
30
|
+
databaseURL: `https://${this.serviceAccount.project_id}.firebaseio.com`
|
|
31
|
+
},appname);
|
|
32
|
+
}else
|
|
33
|
+
admin = admin.initializeApp({
|
|
34
|
+
credential: admin.credential.cert(this.serviceAccount),
|
|
35
|
+
databaseURL: `https://${this.serviceAccount.project_id}.firebaseio.com`
|
|
36
|
+
});
|
|
31
37
|
|
|
32
38
|
const db = admin.firestore();
|
|
33
39
|
this.db = db
|
|
@@ -217,4 +223,4 @@ class FireStoreDB extends MultiDbORM {
|
|
|
217
223
|
|
|
218
224
|
module.exports = {
|
|
219
225
|
FireStoreDB
|
|
220
|
-
}
|
|
226
|
+
}
|
package/engines/sqlitedb.js
CHANGED
|
@@ -158,7 +158,7 @@ class SQLiteDB extends MultiDbORM {
|
|
|
158
158
|
|
|
159
159
|
var where = ''
|
|
160
160
|
for (var key in filter) {
|
|
161
|
-
where = where + `${key} = ${filter[key]} AND `
|
|
161
|
+
where = where + `${key} = '${filter[key]}' AND `
|
|
162
162
|
}
|
|
163
163
|
where = where + " 1 ";
|
|
164
164
|
var query = `DELETE FROM ${modelname} WHERE ${where};`
|