From 6c68bdbd51c03795b6fb020dd437e4aefcd190e8 Mon Sep 17 00:00:00 2001 From: lewismacnow <93997957+lewismacnow@users.noreply.github.com> Date: Tue, 18 Jun 2024 17:35:40 +0100 Subject: [PATCH] 1711 enhance workspace users api (#1712) * Update workspace.js adds userId to the workspaceUsers function * Update openapi.json Updates the workspace/users API docs to display correct 200 response example, including userId, username, role and last update datetime. --- server/models/workspace.js | 1 + server/swagger/openapi.json | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/server/models/workspace.js b/server/models/workspace.js index 501d5fb9d..e59ac4d81 100644 --- a/server/models/workspace.js +++ b/server/models/workspace.js @@ -232,6 +232,7 @@ const Workspace = { const userInfo = usersById.map((user) => { const workspaceUser = users.find((u) => u.user_id === user.id); return { + userId: user.id, username: user.username, role: user.role, lastUpdatedAt: workspaceUser.lastUpdatedAt, diff --git a/server/swagger/openapi.json b/server/swagger/openapi.json index 2a1b55437..38e5ddc4b 100644 --- a/server/swagger/openapi.json +++ b/server/swagger/openapi.json @@ -530,11 +530,15 @@ "users": [ { "userId": 1, - "role": "admin" + "username" : "user_1", + "role": "admin", + "lastUpdatedAt" : "2024-06-10T12:37:52.128Z" }, { "userId": 2, - "role": "member" + "username" : "user_2", + "role": "member", + "lastUpdatedAt" : "2024-06-12T19:10:07.529Z" } ] } @@ -2456,4 +2460,4 @@ "BearerAuth": [] } ] -} \ No newline at end of file +} -- GitLab