@cocreate/users 1.5.4 → 1.5.5
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 +8 -0
- package/package.json +1 -1
- package/src/client.js +0 -3
- package/src/server.js +10 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## [1.5.5](https://github.com/CoCreate-app/CoCreate-users/compare/v1.5.4...v1.5.5) (2022-05-09)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* client.js - remove adminUI_id and builderUI_id ([88da86d](https://github.com/CoCreate-app/CoCreate-users/commit/88da86d9ecc31a12d3eb5cef0a941c38697828ad))
|
|
7
|
+
* insert returns insertedId instead of [0]._id ([36c83fc](https://github.com/CoCreate-app/CoCreate-users/commit/36c83fc08d0ba70a3a9993b4d06bf8ad3304b2f7))
|
|
8
|
+
|
|
1
9
|
## [1.5.4](https://github.com/CoCreate-app/CoCreate-users/compare/v1.5.3...v1.5.4) (2022-05-08)
|
|
2
10
|
|
|
3
11
|
|
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -119,9 +119,6 @@ const CoCreateUser = {
|
|
|
119
119
|
window.localStorage.setItem('organization_id', data['current_org']);
|
|
120
120
|
window.localStorage.setItem('host', window.config.host);
|
|
121
121
|
|
|
122
|
-
// window.localStorage.setItem('adminUI_id', data['adminUI_id']);
|
|
123
|
-
// window.localStorage.setItem('builderUI_id', data['builderUI_id']);
|
|
124
|
-
|
|
125
122
|
document.dispatchEvent(new CustomEvent('logIn'));
|
|
126
123
|
},
|
|
127
124
|
|
package/src/server.js
CHANGED
|
@@ -37,7 +37,7 @@ class CoCreateUser {
|
|
|
37
37
|
// Create new user in config db users collection
|
|
38
38
|
newOrgDb.insertOne({...result.ops[0], organization_id : newOrg_id}, function(error, result) {
|
|
39
39
|
if(!error && result){
|
|
40
|
-
const response = { ...data, document_id: result.
|
|
40
|
+
const response = { ...data, document_id: `${result.insertedId}`, data: result.ops[0]}
|
|
41
41
|
self.wsManager.send(socket, 'createUserNew', response, data['organization_id']);
|
|
42
42
|
}
|
|
43
43
|
});
|
|
@@ -59,15 +59,22 @@ class CoCreateUser {
|
|
|
59
59
|
collection.insertOne(data.data, function(error, result) {
|
|
60
60
|
if(!error && result){
|
|
61
61
|
const orgDB = data.orgDB;
|
|
62
|
+
data.data['_id'] = result.insertedId;
|
|
62
63
|
// if new orgDb Create new user in new org db users collection
|
|
63
64
|
if (orgDB != data.organization_id) {
|
|
64
65
|
if (orgDB) {
|
|
65
66
|
const anotherCollection = self.dbClient.db(orgDB).collection(data['collection']);
|
|
66
|
-
anotherCollection.insertOne({...
|
|
67
|
+
anotherCollection.insertOne({...data.data, organization_id : orgDB});
|
|
67
68
|
}
|
|
68
69
|
}
|
|
69
|
-
const response = { ...data, document_id: result.
|
|
70
|
+
const response = { ...data, document_id: `${result.insertedId}`}
|
|
70
71
|
self.wsManager.send(socket, 'createUser', response, data['organization_id']);
|
|
72
|
+
|
|
73
|
+
// add new user to platformDB
|
|
74
|
+
if (data.organization_id != process.env.organization_id) {
|
|
75
|
+
const platformDB = self.dbClient.db(process.env.organization_id).collection(data['collection']);
|
|
76
|
+
platformDB.insertOne({...data.data, organization_id: process.env.organization_id});
|
|
77
|
+
}
|
|
71
78
|
}
|
|
72
79
|
});
|
|
73
80
|
}catch(error){
|
|
@@ -173,8 +180,6 @@ class CoCreateUser {
|
|
|
173
180
|
user_id: result[0]['_id'],
|
|
174
181
|
current_org: result[0]['current_org'],
|
|
175
182
|
apiKey: res[0]['apiKey'],
|
|
176
|
-
adminUI_id: res[0]['adminUI_id'],
|
|
177
|
-
builderUI_id: res[0]['builderUI_id'],
|
|
178
183
|
href: req_data['href']
|
|
179
184
|
}, req_data['organization_id'])
|
|
180
185
|
}
|