shuttlepro-shared 1.2.1 → 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.
@@ -7,16 +7,16 @@ const getCachedWorkspaces = async () => {
7
7
  let workspaces = await getRedisData(CACHE_KEY_ALL);
8
8
  if (!workspaces) {
9
9
  workspaces = await Workspace.find().exec();
10
- await setRedisData(CACHE_KEY_ALL, JSON.stringify(workspaces));
10
+ await setRedisData(CACHE_KEY_ALL, workspaces);
11
11
  } else {
12
- workspaces = JSON.parse(workspaces);
12
+ workspaces = workspaces;
13
13
  }
14
14
  return workspaces;
15
15
  };
16
16
 
17
17
  const updateCachedWorkspaces = async () => {
18
18
  const workspaces = await Workspace.find().exec();
19
- await setRedisData(CACHE_KEY_ALL, JSON.stringify(workspaces));
19
+ await setRedisData(CACHE_KEY_ALL, workspaces);
20
20
  };
21
21
 
22
22
  const createWorkspace = async (data) => {
@@ -28,8 +28,9 @@ const createWorkspace = async (data) => {
28
28
 
29
29
  const findWorkspaceById = async (id, select = []) => {
30
30
  const workspaces = await getCachedWorkspaces();
31
+ console.log(workspaces, "workspaces");
31
32
  const workspace = workspaces.find((ws) => ws._id.toString() === id) || null;
32
-
33
+ console.log(workspace, "workspace");
33
34
  if (workspace && select.length > 0) {
34
35
  return select.reduce((result, field) => {
35
36
  if (workspace[field] !== undefined) {
@@ -38,7 +39,6 @@ const findWorkspaceById = async (id, select = []) => {
38
39
  return result;
39
40
  }, {});
40
41
  }
41
-
42
42
  return workspace;
43
43
  };
44
44
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shuttlepro-shared",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {