@cocreate/organizations 1.2.0 → 1.2.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 +23 -0
- package/CoCreate.config.js +1 -1
- package/demo/CoCreate-createUser.html +1 -1
- package/demo/index.html +2 -2
- package/demo/industries/industries.html +1 -1
- package/demo/industries/industry-datatable.html +1 -1
- package/demo/industries/industry-documents-datatable.1.html +1 -1
- package/package.json +1 -1
- package/src/client.js +4 -5
- package/src/server.js +6 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
## [1.2.3](https://github.com/CoCreate-app/CoCreate-organizations/compare/v1.2.2...v1.2.3) (2022-05-06)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* replace ObjectID with ObjectId due to mongodb depreciation ([675f499](https://github.com/CoCreate-app/CoCreate-organizations/commit/675f49949d338e735e5d6df8a1be01b9b5f71751))
|
|
7
|
+
* update config organization_Id to organization_id ([be77abe](https://github.com/CoCreate-app/CoCreate-organizations/commit/be77abe662b7839f3f97ad1dcc54835d85dc67c1))
|
|
8
|
+
|
|
9
|
+
## [1.2.2](https://github.com/CoCreate-app/CoCreate-organizations/compare/v1.2.1...v1.2.2) (2022-03-21)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* update class sortable to attribute sortable ([8257806](https://github.com/CoCreate-app/CoCreate-organizations/commit/825780670c4a40eac352e5c83067df9dcea686bd))
|
|
15
|
+
|
|
16
|
+
## [1.2.1](https://github.com/CoCreate-app/CoCreate-organizations/compare/v1.2.0...v1.2.1) (2022-03-06)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* removed param isExact from broadcast as it can be handled by param room ([241b0fe](https://github.com/CoCreate-app/CoCreate-organizations/commit/241b0fec1bd0251604bd43b7cc0d6273c23d4342))
|
|
22
|
+
* update param roomInfo to socketInfo ([fadc197](https://github.com/CoCreate-app/CoCreate-organizations/commit/fadc197cd647b0e951895f787bee6f4f2c92f6d6))
|
|
23
|
+
|
|
1
24
|
# [1.2.0](https://github.com/CoCreate-app/CoCreate-organizations/compare/v1.1.68...v1.2.0) (2022-03-03)
|
|
2
25
|
|
|
3
26
|
|
package/CoCreate.config.js
CHANGED
package/demo/index.html
CHANGED
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
<div class="padding:25px background:gainsboro text-align:left">
|
|
72
72
|
|
|
73
73
|
<!-- Industry select -->
|
|
74
|
-
<cocreate-select class="
|
|
74
|
+
<cocreate-select sortable class="floating-label" collection="organizations" name="industry" placeholder="Industry" realtime="false" save="false">
|
|
75
75
|
<input placeholder="Search" template_id="industries">
|
|
76
76
|
<ul fetch-collection="industries"
|
|
77
77
|
template_id="industries"
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
<script>
|
|
99
99
|
var config = {
|
|
100
100
|
apiKey: 'c2b08663-06e3-440c-ef6f-13978b42883a',
|
|
101
|
-
|
|
101
|
+
organization_id: '5de0387b12e200ea63204d6c',
|
|
102
102
|
host: 'ws.cocreate.app'
|
|
103
103
|
}
|
|
104
104
|
</script>
|
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -3,7 +3,6 @@ import crud from '@cocreate/crud-client';
|
|
|
3
3
|
import action from '@cocreate/actions';
|
|
4
4
|
|
|
5
5
|
const CoCreateOrganization = {
|
|
6
|
-
// masterDB: '5ae0cfac6fb8c4e656fdaf92', // '5ae0cfac6fb8c4e656fdaf92' /** masterDB **/,
|
|
7
6
|
init: function() {
|
|
8
7
|
const self = this;
|
|
9
8
|
crud.listen('createOrgNew', function(data) {
|
|
@@ -24,11 +23,11 @@ const CoCreateOrganization = {
|
|
|
24
23
|
if (!form) return;
|
|
25
24
|
let newOrg_id = form.querySelector("input[collection='organizations'][name='_id']");
|
|
26
25
|
|
|
27
|
-
const room = config.
|
|
26
|
+
const room = config.organization_id;
|
|
28
27
|
|
|
29
28
|
crud.send('createOrgNew', {
|
|
30
29
|
apiKey: config.apiKey,
|
|
31
|
-
organization_id: config.
|
|
30
|
+
organization_id: config.organization_id,
|
|
32
31
|
collection: 'organizations',
|
|
33
32
|
newOrg_id: newOrg_id,
|
|
34
33
|
}, room);
|
|
@@ -52,11 +51,11 @@ const CoCreateOrganization = {
|
|
|
52
51
|
}
|
|
53
52
|
data[name] = value;
|
|
54
53
|
});
|
|
55
|
-
const room = config.
|
|
54
|
+
const room = config.organization_id;
|
|
56
55
|
|
|
57
56
|
crud.send('createOrg', {
|
|
58
57
|
apiKey: config.apiKey,
|
|
59
|
-
organization_id: config.
|
|
58
|
+
organization_id: config.organization_id,
|
|
60
59
|
// orgDb: newOrg,
|
|
61
60
|
mdb: '5ae0cfac6fb8c4e656fdaf92',
|
|
62
61
|
collection: 'organizations',
|
package/src/server.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const {ObjectId} = require("mongodb");
|
|
2
2
|
|
|
3
3
|
class CoCreateOrganization {
|
|
4
4
|
constructor(wsManager, dbClient) {
|
|
@@ -9,9 +9,9 @@ class CoCreateOrganization {
|
|
|
9
9
|
|
|
10
10
|
init() {
|
|
11
11
|
if (this.wsManager) {
|
|
12
|
-
this.wsManager.on('createOrgNew', (socket, data,
|
|
13
|
-
this.wsManager.on('createOrg', (socket, data,
|
|
14
|
-
this.wsManager.on('deleteOrg', (socket, data,
|
|
12
|
+
this.wsManager.on('createOrgNew', (socket, data, socketInfo) => this.createOrgNew(socket, data));
|
|
13
|
+
this.wsManager.on('createOrg', (socket, data, socketInfo) => this.createOrg(socket, data));
|
|
14
|
+
this.wsManager.on('deleteOrg', (socket, data, socketInfo) => this.deleteOrg(socket, data));
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -24,7 +24,7 @@ class CoCreateOrganization {
|
|
|
24
24
|
const db = this.dbClient.db(req_data['organization_id']);
|
|
25
25
|
const collection = db.collection(req_data["collection"]);
|
|
26
26
|
const query = {
|
|
27
|
-
"_id": new
|
|
27
|
+
"_id": new ObjectId(newOrg_id)
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
collection.find(query).toArray(function(error, result) {
|
|
@@ -62,11 +62,7 @@ class CoCreateOrganization {
|
|
|
62
62
|
const response = { ...data, document_id: result.ops[0]._id, data: result.ops[0] }
|
|
63
63
|
|
|
64
64
|
self.wsManager.send(socket, 'createOrg', response );
|
|
65
|
-
|
|
66
|
-
self.wsManager.broadcast(socket, data.namespace || data['organization_id'] , data.room, 'createDocument', response, true);
|
|
67
|
-
} else {
|
|
68
|
-
self.wsManager.broadcast(socket, data.namespace || data['organization_id'], null, 'createDocument', response)
|
|
69
|
-
}
|
|
65
|
+
self.wsManager.broadcast(socket, data.namespace || data['organization_id'] , data.room, 'createDocument', response);
|
|
70
66
|
}
|
|
71
67
|
// add new org to masterDb
|
|
72
68
|
const masterOrgDb = self.dbClient.db(data.mdb).collection(data['collection']);
|