diff options
Diffstat (limited to 'src/internal-server/app/Controllers/Http/WorkspaceController.js')
-rw-r--r-- | src/internal-server/app/Controllers/Http/WorkspaceController.js | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/internal-server/app/Controllers/Http/WorkspaceController.js b/src/internal-server/app/Controllers/Http/WorkspaceController.js index 528721f13..9ba2b174e 100644 --- a/src/internal-server/app/Controllers/Http/WorkspaceController.js +++ b/src/internal-server/app/Controllers/Http/WorkspaceController.js | |||
@@ -25,11 +25,13 @@ class WorkspaceController { | |||
25 | do { | 25 | do { |
26 | workspaceId = uuid(); | 26 | workspaceId = uuid(); |
27 | } while ( | 27 | } while ( |
28 | // eslint-disable-next-line no-await-in-loop, unicorn/no-await-expression-member | ||
28 | (await Workspace.query().where('workspaceId', workspaceId).fetch()).rows | 29 | (await Workspace.query().where('workspaceId', workspaceId).fetch()).rows |
29 | .length > 0 | 30 | .length > 0 |
30 | ); | 31 | ); |
31 | 32 | ||
32 | const order = (await Workspace.all()).rows.length; | 33 | const allWorkspaces = await Workspace.all(); |
34 | const order = allWorkspaces.rows.length; | ||
33 | const { name } = data; | 35 | const { name } = data; |
34 | delete data.name; | 36 | delete data.name; |
35 | 37 | ||
@@ -76,8 +78,10 @@ class WorkspaceController { | |||
76 | }); | 78 | }); |
77 | 79 | ||
78 | // Get updated row | 80 | // Get updated row |
79 | const workspace = (await Workspace.query().where('workspaceId', id).fetch()) | 81 | const workspaceQuery = await Workspace.query() |
80 | .rows[0]; | 82 | .where('workspaceId', id) |
83 | .fetch(); | ||
84 | const workspace = workspaceQuery.rows[0]; | ||
81 | 85 | ||
82 | return response.send({ | 86 | return response.send({ |
83 | id: workspace.workspaceId, | 87 | id: workspace.workspaceId, |
@@ -118,7 +122,8 @@ class WorkspaceController { | |||
118 | 122 | ||
119 | // List all workspaces a user has created | 123 | // List all workspaces a user has created |
120 | async list({ response }) { | 124 | async list({ response }) { |
121 | const workspaces = (await Workspace.all()).rows; | 125 | const allWorkspaces = await Workspace.all(); |
126 | const workspaces = allWorkspaces.rows; | ||
122 | // Convert to array with all data Franz wants | 127 | // Convert to array with all data Franz wants |
123 | let workspacesArray = []; | 128 | let workspacesArray = []; |
124 | if (workspaces) { | 129 | if (workspaces) { |