@cocreate/organizations 1.18.0 → 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 CHANGED
@@ -1,3 +1,22 @@
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
+
13
+ ## [1.18.1](https://github.com/CoCreate-app/CoCreate-organizations/compare/v1.18.0...v1.18.1) (2023-08-21)
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * bump dependencies ([348f589](https://github.com/CoCreate-app/CoCreate-organizations/commit/348f589692f609859c0ef67ec472e9d66a8e3bd9))
19
+
1
20
  # [1.18.0](https://github.com/CoCreate-app/CoCreate-organizations/compare/v1.17.1...v1.18.0) (2023-08-21)
2
21
 
3
22
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/organizations",
3
- "version": "1.18.0",
3
+ "version": "1.19.0",
4
4
  "description": "A simple organizations component in vanilla javascript. Easily configured using HTML5 attributes and/or JavaScript API.",
5
5
  "keywords": [
6
6
  "organizations",
@@ -58,8 +58,8 @@
58
58
  "webpack-log": "^3.0.1"
59
59
  },
60
60
  "dependencies": {
61
- "@cocreate/actions": "^1.10.2",
62
- "@cocreate/crud-client": "^1.23.1",
63
- "@cocreate/elements": "^1.19.3"
61
+ "@cocreate/actions": "^1.11.0",
62
+ "@cocreate/crud-client": "^1.24.0",
63
+ "@cocreate/elements": "^1.20.0"
64
64
  }
65
65
  }
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', (socket, data) =>
16
- this.createOrganization(socket, data)
15
+ this.wsManager.on('createOrganization', (data) =>
16
+ this.createOrganization(data)
17
17
  );
18
18
  }
19
19
  }
20
20
 
21
- async createOrganization(socket, data) {
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(socket, data);
72
+ this.wsManager.send(data);
71
73
  } catch (error) {
72
74
  console.log('createObject error', error);
73
75
  }