@gudhub/core 1.1.153 → 1.1.155

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.
@@ -54,6 +54,14 @@ export class Auth {
54
54
  return usersList;
55
55
  }
56
56
 
57
+ async getUserWorkspace() {
58
+ const usersList = await this.getUserWorkspaceApi();
59
+
60
+ usersList.forEach((user) => this.saveUserToStorage(user));
61
+
62
+ return usersList;
63
+ }
64
+
57
65
  async loginApi(username, password) {
58
66
  try {
59
67
  const user = await this.req.axiosRequest({
@@ -128,6 +136,10 @@ export class Auth {
128
136
  });
129
137
  }
130
138
 
139
+ getUserWorkspaceApi() {
140
+ return this.req.get({ url: "/auth/get-user-workspace" });
141
+ }
142
+
131
143
  updateUserApi(userData) {
132
144
  return this.req.post({
133
145
  url: "/auth/updateuser",
@@ -57,6 +57,17 @@ describe("AUTHORIZATION", async function() {
57
57
  user.fullname.should.equal('Vasya Pupkin');
58
58
  })
59
59
 
60
+ it("Get user workspace / It should return workspace users and cache them in storage", async function () {
61
+ const gudhub = new GudHub(auth_key);
62
+ const usersList = await gudhub.getUserWorkspace();
63
+
64
+ usersList.length.should.be.above(0);
65
+
66
+ usersList.forEach((user) => {
67
+ gudhub.storage.getUsersList().find((u) => u.user_id == user.user_id).should.be.ok;
68
+ });
69
+ })
70
+
60
71
  it("Update user avatar", async function() {
61
72
  const gudhub = new GudHub(auth_key);
62
73
 
@@ -114,6 +114,14 @@ export default function generateModulesList(async_modules_path, file_server_url,
114
114
  type: 'gh_element',
115
115
  technology: 'angular'
116
116
  },
117
+ {
118
+ data_type: "spreadsheet_report",
119
+ name: "Spreadsheet Report",
120
+ icon: "table",
121
+ url: file_server_url + '/' + async_modules_path + "spreadsheet_report_data.js",
122
+ type: 'gh_element',
123
+ technology: 'angular'
124
+ },
117
125
  {
118
126
  data_type: 'funnel_chart',
119
127
  name: "Funnel chart",
@@ -1088,6 +1096,14 @@ export default function generateModulesList(async_modules_path, file_server_url,
1088
1096
  type: "gh_element",
1089
1097
  technology: "class",
1090
1098
  },
1099
+ {
1100
+ data_type: "survey_quiz",
1101
+ name: 'Quiz & Survey',
1102
+ icon: 'option_gh_element',
1103
+ url: file_server_url + '/' + async_modules_path + "survey_quiz_data.js",
1104
+ type: 'gh_element',
1105
+ technology: 'angular'
1106
+ },
1091
1107
  /* AUTOMATION MODULES */
1092
1108
  /*
1093
1109
  We have next types for automations:
@@ -6,11 +6,12 @@ export class GroupManager {
6
6
 
7
7
  //********************* CREATE GROUP *********************//
8
8
 
9
- async createGroupApi(groupName) {
9
+ async createGroupApi(groupName, isPrivate = false) {
10
10
  try {
11
11
  const form = {
12
12
  token: await this.gudhub.auth.getToken(),
13
13
  group_name: groupName,
14
+ private: isPrivate,
14
15
  };
15
16
  const group = await this.req.post({
16
17
  url: "/api/sharing-group/create-group",
@@ -9,8 +9,8 @@ export class GroupSharing {
9
9
  this.appGroupSharing = new AppGroupSharing(gudhub, req);
10
10
  }
11
11
 
12
- createGroup(groupName) {
13
- return this.groupManager.createGroupApi(groupName);
12
+ createGroup(groupName, isPrivate = false) {
13
+ return this.groupManager.createGroupApi(groupName, isPrivate);
14
14
  }
15
15
 
16
16
  updateGroup(groupId, groupName) {
package/GUDHUB/gudhub.js CHANGED
@@ -482,6 +482,10 @@ export class GudHub {
482
482
  return this.auth.getUsersList(keyword);
483
483
  }
484
484
 
485
+ getUserWorkspace() {
486
+ return this.auth.getUserWorkspace();
487
+ }
488
+
485
489
  updateToken(auth_key) {
486
490
  return this.auth.updateToken(auth_key);
487
491
  }
package/Readme.md CHANGED
@@ -43,6 +43,7 @@ I't a Library to simplify work with GudHub API. Also this Library contains utili
43
43
  - [signup()](#signup)
44
44
  - [getUserById()](#getuserbyid)
45
45
  - [getUsersList()](#getuserslist)
46
+ - [getUserWorkspace()](#getuserworkspace)
46
47
  - [updateUser()](#updateuser)
47
48
  - [getToken()](#gettoken)
48
49
  - [updateToken()](#updatetoken)
@@ -294,6 +295,16 @@ gudhub.getUsersList(keyword);
294
295
 
295
296
  Read more information about [getUsersList on GudHub](https://app.gudhub.com/docs/core-api/auth-core-api/#getuserslist).
296
297
 
298
+ ### getUserWorkspace()
299
+
300
+ This method is used to get the list of users belonging to the current user's workspace. Returned users are cached in storage.
301
+
302
+ ```js
303
+ gudhub.getUserWorkspace();
304
+ ```
305
+
306
+ Read more information about [getUserWorkspace on GudHub](https://app.gudhub.com/docs/core-api/auth-core-api/#getuserworkspace).
307
+
297
308
  ### updateUser()
298
309
 
299
310
  This is the method used to update user account data.
@@ -80,6 +80,13 @@ export default function (app) {
80
80
  res.status(200).send(data.token);
81
81
  });
82
82
 
83
+ app.get('/auth/get-user-workspace', (req, res) => {
84
+ res.status(200).send([
85
+ { user_id: "58", fullname: "Vasya Pupkin", avatar_128: "https://app.gudhub.com/avatars/58_5556_128.jpg", avatar_512: "https://app.gudhub.com/avatars/58_5556_512.jpg" },
86
+ { user_id: "59", fullname: "Petya Ronaldinho", avatar_128: "https://app.gudhub.com/avatars/59_5556_128.jpg", avatar_512: "https://app.gudhub.com/avatars/59_5556_512.jpg" },
87
+ ]);
88
+ });
89
+
83
90
 
84
91
  app.post('/api/items/update', (req, res) => {
85
92
  let result = null;
@@ -293,7 +300,7 @@ export default function (app) {
293
300
  });
294
301
 
295
302
  app.post('/api/sharing-group/create-group', (req, res) => {
296
- res.status(200).send({ group_id: 1, group_name: req.body.group_name });
303
+ res.status(200).send({ group_id: 1, group_name: req.body.group_name, private: req.body.private === true || req.body.private === 'true' });
297
304
  })
298
305
 
299
306
  app.post('/api/sharing-group/update-group', (req, res) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gudhub/core",
3
- "version": "1.1.153",
3
+ "version": "1.1.155",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {