@cocreate/organizations 1.18.1 → 1.19.0
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 +12 -0
- package/package.json +1 -1
- package/src/server.js +7 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
# [1.19.0](https://github.com/CoCreate-app/CoCreate-organizations/compare/v1.18.1...v1.19.0) (2023-09-17)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* socket referenced in the data object. data.socket ([121c8ab](https://github.com/CoCreate-app/CoCreate-organizations/commit/121c8ab1c37b0c980148fd28b14cede8e5a80aa0))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* set balance and dataTransfered on newly created organizations ([f20747b](https://github.com/CoCreate-app/CoCreate-organizations/commit/f20747bf2463d79afd24530afb529331285e7670))
|
|
12
|
+
|
|
1
13
|
## [1.18.1](https://github.com/CoCreate-app/CoCreate-organizations/compare/v1.18.0...v1.18.1) (2023-08-21)
|
|
2
14
|
|
|
3
15
|
|
package/package.json
CHANGED
package/src/server.js
CHANGED
|
@@ -12,13 +12,13 @@ class CoCreateOrganization {
|
|
|
12
12
|
|
|
13
13
|
init() {
|
|
14
14
|
if (this.wsManager) {
|
|
15
|
-
this.wsManager.on('createOrganization', (
|
|
16
|
-
this.createOrganization(
|
|
15
|
+
this.wsManager.on('createOrganization', (data) =>
|
|
16
|
+
this.createOrganization(data)
|
|
17
17
|
);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
async createOrganization(
|
|
21
|
+
async createOrganization(data) {
|
|
22
22
|
try {
|
|
23
23
|
if (!data.organization || !data.organization._id) return
|
|
24
24
|
if (!data.user || !data.user._id || !data.user.email || !data.user.password) return
|
|
@@ -27,7 +27,9 @@ class CoCreateOrganization {
|
|
|
27
27
|
_id: data.organization._id,
|
|
28
28
|
name: data.organization.name || 'untitled',
|
|
29
29
|
host: data.organization.host || [],
|
|
30
|
-
owner: data.user._id
|
|
30
|
+
owner: data.user._id,
|
|
31
|
+
balance: 10, // TODO: set balance to 0 and create a transcation with type credit to add the $10
|
|
32
|
+
dataTransfered: 0
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
// TODO: check if user exist and confirm credentials
|
|
@@ -67,7 +69,7 @@ class CoCreateOrganization {
|
|
|
67
69
|
this.wsManager.broadcast(this.platformSocket, response);
|
|
68
70
|
}
|
|
69
71
|
|
|
70
|
-
this.wsManager.send(
|
|
72
|
+
this.wsManager.send(data);
|
|
71
73
|
} catch (error) {
|
|
72
74
|
console.log('createObject error', error);
|
|
73
75
|
}
|