@cocreate/crud-server 1.20.0 → 1.20.2
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 +14 -0
- package/package.json +1 -1
- package/src/index.js +21 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [1.20.2](https://github.com/CoCreate-app/CoCreate-crud-server/compare/v1.20.1...v1.20.2) (2023-05-07)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* if platform org set dbUrl ([0dbafc9](https://github.com/CoCreate-app/CoCreate-crud-server/commit/0dbafc9b5ba77f3d16a5e14105a67e358ad697b8))
|
|
7
|
+
|
|
8
|
+
## [1.20.1](https://github.com/CoCreate-app/CoCreate-crud-server/compare/v1.20.0...v1.20.1) (2023-04-11)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* urls typo ([94b4f83](https://github.com/CoCreate-app/CoCreate-crud-server/commit/94b4f8377aff42c59364e357e34199107f437a52))
|
|
14
|
+
|
|
1
15
|
# [1.20.0](https://github.com/CoCreate-app/CoCreate-crud-server/compare/v1.19.1...v1.20.0) (2023-04-11)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -105,22 +105,27 @@ class CoCreateCrudServer {
|
|
|
105
105
|
resolve()
|
|
106
106
|
|
|
107
107
|
if (!dbUrl) {
|
|
108
|
-
|
|
109
|
-
dbUrl
|
|
110
|
-
database: process.env.organization_id,
|
|
111
|
-
collection: 'organizations',
|
|
112
|
-
document: [{_id: data.organization_id}],
|
|
113
|
-
organization_id: process.env.organization_id
|
|
114
|
-
})
|
|
115
|
-
if (organization && organization.document && organization.document[0])
|
|
116
|
-
organization = organization.document[0]
|
|
117
|
-
if (organization && organization.databases) {
|
|
118
|
-
dbUrl = organization.databases
|
|
108
|
+
if (data.organization_id === process.env.organization_id) {
|
|
109
|
+
dbUrl = { [this.database.name]: this.database}
|
|
119
110
|
this.databaseUrls.set(data.organization_id, dbUrl)
|
|
120
111
|
} else {
|
|
121
|
-
this.
|
|
122
|
-
|
|
123
|
-
|
|
112
|
+
let organization = await this.databases[this.database.name]['readDocument']({
|
|
113
|
+
dbUrl: this.database.url[0],
|
|
114
|
+
database: process.env.organization_id,
|
|
115
|
+
collection: 'organizations',
|
|
116
|
+
document: [{_id: data.organization_id}],
|
|
117
|
+
organization_id: process.env.organization_id
|
|
118
|
+
})
|
|
119
|
+
if (organization && organization.document && organization.document[0])
|
|
120
|
+
organization = organization.document[0]
|
|
121
|
+
if (organization && organization.databases) {
|
|
122
|
+
dbUrl = organization.databases
|
|
123
|
+
this.databaseUrls.set(data.organization_id, dbUrl)
|
|
124
|
+
} else {
|
|
125
|
+
this.databaseUrls.set(data.organization_id, 'false')
|
|
126
|
+
console.log('organization or dbUrl urls could not be found')
|
|
127
|
+
resolve()
|
|
128
|
+
}
|
|
124
129
|
}
|
|
125
130
|
}
|
|
126
131
|
|
|
@@ -175,8 +180,8 @@ class CoCreateCrudServer {
|
|
|
175
180
|
|
|
176
181
|
if (db.name && this.databases[db.name]) {
|
|
177
182
|
|
|
178
|
-
for (let i = 0; i < db.
|
|
179
|
-
data['dbUrl'] = db.
|
|
183
|
+
for (let i = 0; i < db.url.length; i++) {
|
|
184
|
+
data['dbUrl'] = db.url[i]
|
|
180
185
|
data = await this.databases[db.name][action](data)
|
|
181
186
|
}
|
|
182
187
|
|