@cocreate/crud-server 1.24.2 → 1.24.3
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 +7 -0
- package/package.json +1 -1
- package/src/index.js +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [1.24.3](https://github.com/CoCreate-app/CoCreate-crud-server/compare/v1.24.2...v1.24.3) (2023-06-15)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* process.env.storage replaced with this.config.storage ([547d9db](https://github.com/CoCreate-app/CoCreate-crud-server/commit/547d9db0a41d0a77b6032245292b32e38b85ace0))
|
|
7
|
+
|
|
1
8
|
## [1.24.2](https://github.com/CoCreate-app/CoCreate-crud-server/compare/v1.24.1...v1.24.2) (2023-06-15)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -134,16 +134,16 @@ class CoCreateCrudServer {
|
|
|
134
134
|
return resolve({ storage: false, error: 'A storage or database could not be found' })
|
|
135
135
|
|
|
136
136
|
if (!storage) {
|
|
137
|
-
if (data.organization_id ===
|
|
138
|
-
storage =
|
|
137
|
+
if (data.organization_id === this.config.orgaization_id) {
|
|
138
|
+
storage = pthis.config.storage
|
|
139
139
|
if (storage)
|
|
140
140
|
this.storages.set(data.organization_id, JSON.parse(storage))
|
|
141
141
|
} else {
|
|
142
142
|
let organization = await this.readDocument({
|
|
143
|
-
database:
|
|
143
|
+
database: this.config.organization_id,
|
|
144
144
|
collection: 'organizations',
|
|
145
145
|
document: [{ _id: data.organization_id }],
|
|
146
|
-
organization_id:
|
|
146
|
+
organization_id: this.config.organization_id
|
|
147
147
|
})
|
|
148
148
|
if (organization && organization.document && organization.document[0])
|
|
149
149
|
organization = organization.document[0]
|
|
@@ -171,7 +171,7 @@ class CoCreateCrudServer {
|
|
|
171
171
|
if (!data.database)
|
|
172
172
|
data['database'] = data.organization_id
|
|
173
173
|
|
|
174
|
-
if (action === 'updateDocument' && data.organization_id !==
|
|
174
|
+
if (action === 'updateDocument' && data.organization_id !== this.config.organization_id) {
|
|
175
175
|
let syncKeys
|
|
176
176
|
if (data.collection === 'organizations')
|
|
177
177
|
syncKeys = ['name', 'logo', 'databases', 'host', 'apis']
|
|
@@ -180,10 +180,10 @@ class CoCreateCrudServer {
|
|
|
180
180
|
|
|
181
181
|
if (syncKeys && syncKeys.length) {
|
|
182
182
|
let platformUpdate = {
|
|
183
|
-
database:
|
|
183
|
+
database: this.config.organization_id,
|
|
184
184
|
collection: data.collection,
|
|
185
185
|
document: [{}],
|
|
186
|
-
organization_id:
|
|
186
|
+
organization_id: this.config.organization_id
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
let document = data.document[0] || data.document
|
|
@@ -225,10 +225,10 @@ class CoCreateCrudServer {
|
|
|
225
225
|
|
|
226
226
|
delete data.dbUrl
|
|
227
227
|
if (socket) {
|
|
228
|
-
if (data.organization_id ===
|
|
228
|
+
if (data.organization_id === this.config.organization_id && socket.config.organization_id !== data.organization_id) {
|
|
229
229
|
this.wsManager.broadcast({
|
|
230
230
|
config: {
|
|
231
|
-
organization_id:
|
|
231
|
+
organization_id: this.config.organization_id,
|
|
232
232
|
}
|
|
233
233
|
}, action, { ...data });
|
|
234
234
|
data.organization_id = socket.config.organization_id
|