@cocreate/organizations 1.10.9 → 1.10.10
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 +18 -22
- package/src/server.js +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## [1.10.10](https://github.com/CoCreate-app/CoCreate-organizations/compare/v1.10.9...v1.10.10) (2023-04-13)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* broadcast user doc ([20175d4](https://github.com/CoCreate-app/CoCreate-organizations/commit/20175d4d1e7c624e0ca4334ef0e7c89b1c9c027b))
|
|
7
|
+
* commented code that was related to creating new db ([147b1dd](https://github.com/CoCreate-app/CoCreate-organizations/commit/147b1dd54cdbf0a41fe724b5d138d3b3a449047d))
|
|
8
|
+
|
|
1
9
|
## [1.10.9](https://github.com/CoCreate-app/CoCreate-organizations/compare/v1.10.8...v1.10.9) (2023-04-12)
|
|
2
10
|
|
|
3
11
|
|
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -22,42 +22,38 @@ const CoCreateOrganization = {
|
|
|
22
22
|
let elements = form.querySelectorAll("[collection='organizations'][name]");
|
|
23
23
|
|
|
24
24
|
let data = {document: {}};
|
|
25
|
-
//. get form data
|
|
26
25
|
elements.forEach(el => {
|
|
27
26
|
let name = el.getAttribute('name');
|
|
28
27
|
let value = el.getValue();
|
|
29
28
|
if (!name || !value) return;
|
|
30
|
-
if (el.getAttribute('data-type') == 'array') {
|
|
31
|
-
value = [value];
|
|
32
|
-
}
|
|
33
29
|
data.document[name] = value;
|
|
34
30
|
});
|
|
35
31
|
|
|
36
|
-
const socket = crud.socket.getSockets()
|
|
37
|
-
if (!socket[0] || !socket[0].connected || window && !window.navigator.onLine) {
|
|
32
|
+
// const socket = crud.socket.getSockets()
|
|
33
|
+
// if (!socket[0] || !socket[0].connected || window && !window.navigator.onLine) {
|
|
38
34
|
data.collection = 'organizations'
|
|
39
|
-
data.document['_id'] = crud.ObjectId()
|
|
40
|
-
data.document['name'] = 'untitled'
|
|
41
|
-
localStorage.setItem('apiKey', uuid.generate(32));
|
|
42
|
-
localStorage.setItem('organization_id', data['_id']);
|
|
35
|
+
// data.document['_id'] = crud.ObjectId()
|
|
36
|
+
// data.document['name'] = 'untitled'
|
|
37
|
+
// localStorage.setItem('apiKey', uuid.generate(32));
|
|
38
|
+
// localStorage.setItem('organization_id', data['_id']);
|
|
43
39
|
crud.createDocument(data).then((response) => {
|
|
44
|
-
data.database = data.document[0]['_id']
|
|
45
|
-
data.organization_id = data.document[0]['_id']
|
|
46
|
-
crud.createDocument(data).then((response) => {
|
|
40
|
+
// data.database = data.document[0]['_id']
|
|
41
|
+
// data.organization_id = data.document[0]['_id']
|
|
42
|
+
// crud.createDocument(data).then((response) => {
|
|
47
43
|
|
|
48
|
-
document.dispatchEvent(new CustomEvent('
|
|
44
|
+
document.dispatchEvent(new CustomEvent('createdOrg', {
|
|
49
45
|
detail: response
|
|
50
46
|
}));
|
|
51
47
|
|
|
52
|
-
})
|
|
48
|
+
// })
|
|
53
49
|
})
|
|
54
|
-
} else {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
50
|
+
// } else {
|
|
51
|
+
// crud.socket.send('createOrg', {
|
|
52
|
+
// collection: 'organizations',
|
|
53
|
+
// ...data,
|
|
54
|
+
// broadcastBrowser: false
|
|
55
|
+
// });
|
|
56
|
+
// }
|
|
61
57
|
},
|
|
62
58
|
|
|
63
59
|
setDocumentId: function(collection, id) {
|
package/src/server.js
CHANGED
|
@@ -29,6 +29,8 @@ class CoCreateOrganization {
|
|
|
29
29
|
// self.wsManager.send(socket, 'createOrg', data);
|
|
30
30
|
// self.wsManager.broadcast(socket, 'createDocument', data);
|
|
31
31
|
// })
|
|
32
|
+
|
|
33
|
+
self.wsManager.broadcast(socket, 'updateDocument', data);
|
|
32
34
|
self.wsManager.send(socket, 'createOrg', data);
|
|
33
35
|
|
|
34
36
|
// add new org to platformDB
|