@cocreate/crud-server
Advanced tools
Comparing version
@@ -0,1 +1,8 @@ | ||
## [1.20.2](https://github.com/CoCreate-app/CoCreate-crud-server/compare/v1.20.1...v1.20.2) (2023-05-07) | ||
### Bug Fixes | ||
* if platform org set dbUrl ([0dbafc9](https://github.com/CoCreate-app/CoCreate-crud-server/commit/0dbafc9b5ba77f3d16a5e14105a67e358ad697b8)) | ||
## [1.20.1](https://github.com/CoCreate-app/CoCreate-crud-server/compare/v1.20.0...v1.20.1) (2023-04-11) | ||
@@ -2,0 +9,0 @@ |
{ | ||
"name": "@cocreate/crud-server", | ||
"version": "1.20.1", | ||
"version": "1.20.2", | ||
"description": "CoCreate-crud-server", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -108,18 +108,23 @@ 'use strict'; | ||
if (!dbUrl) { | ||
let organization = await this.databases[this.database.name]['readDocument']({ | ||
dbUrl: this.database.url[0], | ||
database: process.env.organization_id, | ||
collection: 'organizations', | ||
document: [{_id: data.organization_id}], | ||
organization_id: process.env.organization_id | ||
}) | ||
if (organization && organization.document && organization.document[0]) | ||
organization = organization.document[0] | ||
if (organization && organization.databases) { | ||
dbUrl = organization.databases | ||
if (data.organization_id === process.env.organization_id) { | ||
dbUrl = { [this.database.name]: this.database} | ||
this.databaseUrls.set(data.organization_id, dbUrl) | ||
} else { | ||
this.databaseUrls.set(data.organization_id, 'false') | ||
console.log('organization or dbUrl urls could not be found') | ||
resolve() | ||
let organization = await this.databases[this.database.name]['readDocument']({ | ||
dbUrl: this.database.url[0], | ||
database: process.env.organization_id, | ||
collection: 'organizations', | ||
document: [{_id: data.organization_id}], | ||
organization_id: process.env.organization_id | ||
}) | ||
if (organization && organization.document && organization.document[0]) | ||
organization = organization.document[0] | ||
if (organization && organization.databases) { | ||
dbUrl = organization.databases | ||
this.databaseUrls.set(data.organization_id, dbUrl) | ||
} else { | ||
this.databaseUrls.set(data.organization_id, 'false') | ||
console.log('organization or dbUrl urls could not be found') | ||
resolve() | ||
} | ||
} | ||
@@ -126,0 +131,0 @@ } |
93453
0.51%362
1.4%6
20%