@cocreate/crud-server 1.19.0 → 1.19.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.19.1](https://github.com/CoCreate-app/CoCreate-crud-server/compare/v1.19.0...v1.19.1) (2023-04-11)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * pass dbUrl to constructor ([7900c05](https://github.com/CoCreate-app/CoCreate-crud-server/commit/7900c0539998cb5f42cd27aed3844d0d43f5370b))
7
+
1
8
  # [1.19.0](https://github.com/CoCreate-app/CoCreate-crud-server/compare/v1.18.0...v1.19.0) (2023-04-11)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/crud-server",
3
- "version": "1.19.0",
3
+ "version": "1.19.1",
4
4
  "description": "CoCreate-crud-server",
5
5
  "keywords": [
6
6
  "cocreate-crud",
package/src/index.js CHANGED
@@ -3,9 +3,10 @@
3
3
  const {ObjectId, searchData, sortData} = require("@cocreate/utils");
4
4
 
5
5
  class CoCreateCrudServer {
6
- constructor(wsManager, databases) {
6
+ constructor(wsManager, databases, dbUrl) {
7
7
  this.wsManager = wsManager
8
8
  this.databases = databases
9
+ this.dbUrl = dbUrl
9
10
  this.ObjectId = ObjectId
10
11
  this.databaseUrls = new Map();
11
12
  this.init();
@@ -105,7 +106,7 @@ class CoCreateCrudServer {
105
106
 
106
107
  if (!dbUrl) {
107
108
  if (data.organization_id === process.env.organization_id) {
108
- dbUrl = {mongodb: [process.env.MONGO_URL]}
109
+ dbUrl = this.dbUrl
109
110
  console.log('platform dbUrl crud', dbUrl)
110
111
  this.databaseUrls.set(data.organization_id, dbUrl)
111
112
  } else {
@@ -162,7 +163,7 @@ class CoCreateCrudServer {
162
163
 
163
164
  if (syncKeys && syncKeys.length) {
164
165
  let platformUpdate = {
165
- dbUrl: process.env.MONGO_URL,
166
+ dbUrl: dbUrl[data.db[i]][0],
166
167
  database: process.env.organization_id,
167
168
  collection: data.collection,
168
169
  document: [{}],