diff --git a/cli/testdata/coder_users_list_--help.golden b/cli/testdata/coder_users_list_--help.golden index de9d3c2d2840d..c2e279af699fa 100644 --- a/cli/testdata/coder_users_list_--help.golden +++ b/cli/testdata/coder_users_list_--help.golden @@ -8,7 +8,7 @@ USAGE: OPTIONS: -c, --column string-array (default: username,email,created_at,status) Columns to display in table output. Available columns: id, username, - email, created at, status. + email, created at, updated at, status. -o, --output string (default: table) Output format. Available formats: table, json. diff --git a/cli/testdata/coder_users_list_--output_json.golden b/cli/testdata/coder_users_list_--output_json.golden index 3c7ff44b6675a..6f180db5af39c 100644 --- a/cli/testdata/coder_users_list_--output_json.golden +++ b/cli/testdata/coder_users_list_--output_json.golden @@ -6,6 +6,7 @@ "name": "Test User", "email": "testuser@coder.com", "created_at": "[timestamp]", + "updated_at": "[timestamp]", "last_seen_at": "[timestamp]", "status": "active", "login_type": "password", @@ -27,6 +28,7 @@ "name": "", "email": "testuser2@coder.com", "created_at": "[timestamp]", + "updated_at": "[timestamp]", "last_seen_at": "[timestamp]", "status": "dormant", "login_type": "password", diff --git a/coderd/apidoc/docs.go b/coderd/apidoc/docs.go index d9f6bef9919e1..60b7bbfd0f06d 100644 --- a/coderd/apidoc/docs.go +++ b/coderd/apidoc/docs.go @@ -11134,6 +11134,10 @@ const docTemplate = `{ "theme_preference": { "type": "string" }, + "updated_at": { + "type": "string", + "format": "date-time" + }, "username": { "type": "string" } @@ -11949,6 +11953,10 @@ const docTemplate = `{ "theme_preference": { "type": "string" }, + "updated_at": { + "type": "string", + "format": "date-time" + }, "username": { "type": "string" } @@ -12518,6 +12526,10 @@ const docTemplate = `{ "theme_preference": { "type": "string" }, + "updated_at": { + "type": "string", + "format": "date-time" + }, "username": { "type": "string" } diff --git a/coderd/apidoc/swagger.json b/coderd/apidoc/swagger.json index 5320b41c09746..43db2a118291a 100644 --- a/coderd/apidoc/swagger.json +++ b/coderd/apidoc/swagger.json @@ -10040,6 +10040,10 @@ "theme_preference": { "type": "string" }, + "updated_at": { + "type": "string", + "format": "date-time" + }, "username": { "type": "string" } @@ -10832,6 +10836,10 @@ "theme_preference": { "type": "string" }, + "updated_at": { + "type": "string", + "format": "date-time" + }, "username": { "type": "string" } @@ -11353,6 +11361,10 @@ "theme_preference": { "type": "string" }, + "updated_at": { + "type": "string", + "format": "date-time" + }, "username": { "type": "string" } diff --git a/coderd/database/db2sdk/db2sdk.go b/coderd/database/db2sdk/db2sdk.go index 3c39423e2d917..10149dac44ece 100644 --- a/coderd/database/db2sdk/db2sdk.go +++ b/coderd/database/db2sdk/db2sdk.go @@ -151,6 +151,7 @@ func ReducedUser(user database.User) codersdk.ReducedUser { Email: user.Email, Name: user.Name, CreatedAt: user.CreatedAt, + UpdatedAt: user.UpdatedAt, LastSeenAt: user.LastSeenAt, Status: codersdk.UserStatus(user.Status), LoginType: codersdk.LoginType(user.LoginType), diff --git a/codersdk/users.go b/codersdk/users.go index 16b6a5df6489d..391363309f577 100644 --- a/codersdk/users.go +++ b/codersdk/users.go @@ -51,6 +51,7 @@ type ReducedUser struct { Name string `json:"name"` Email string `json:"email" validate:"required" table:"email" format:"email"` CreatedAt time.Time `json:"created_at" validate:"required" table:"created at" format:"date-time"` + UpdatedAt time.Time `json:"updated_at" table:"updated at" format:"date-time"` LastSeenAt time.Time `json:"last_seen_at" format:"date-time"` Status UserStatus `json:"status" table:"status" enums:"active,suspended"` diff --git a/docs/api/audit.md b/docs/api/audit.md index 0c2cf32cd2758..a20ec563a003a 100644 --- a/docs/api/audit.md +++ b/docs/api/audit.md @@ -74,6 +74,7 @@ curl -X GET http://coder-server:8080/api/v2/audit?limit=0 \ ], "status": "active", "theme_preference": "string", + "updated_at": "2019-08-24T14:15:22Z", "username": "string" }, "user_agent": "string" diff --git a/docs/api/enterprise.md b/docs/api/enterprise.md index 3f6013d46cfb5..876e6e9d5c554 100644 --- a/docs/api/enterprise.md +++ b/docs/api/enterprise.md @@ -212,6 +212,7 @@ curl -X GET http://coder-server:8080/api/v2/groups/{group} \ "name": "string", "status": "active", "theme_preference": "string", + "updated_at": "2019-08-24T14:15:22Z", "username": "string" } ], @@ -269,6 +270,7 @@ curl -X DELETE http://coder-server:8080/api/v2/groups/{group} \ "name": "string", "status": "active", "theme_preference": "string", + "updated_at": "2019-08-24T14:15:22Z", "username": "string" } ], @@ -341,6 +343,7 @@ curl -X PATCH http://coder-server:8080/api/v2/groups/{group} \ "name": "string", "status": "active", "theme_preference": "string", + "updated_at": "2019-08-24T14:15:22Z", "username": "string" } ], @@ -1071,6 +1074,7 @@ curl -X GET http://coder-server:8080/api/v2/organizations/{organization}/groups "name": "string", "status": "active", "theme_preference": "string", + "updated_at": "2019-08-24T14:15:22Z", "username": "string" } ], @@ -1108,6 +1112,7 @@ Status Code **200** | `»» name` | string | false | | | | `»» status` | [codersdk.UserStatus](schemas.md#codersdkuserstatus) | false | | | | `»» theme_preference` | string | false | | | +| `»» updated_at` | string(date-time) | false | | | | `»» username` | string | true | | | | `» name` | string | false | | | | `» organization_id` | string(uuid) | false | | | @@ -1183,6 +1188,7 @@ curl -X POST http://coder-server:8080/api/v2/organizations/{organization}/groups "name": "string", "status": "active", "theme_preference": "string", + "updated_at": "2019-08-24T14:15:22Z", "username": "string" } ], @@ -1241,6 +1247,7 @@ curl -X GET http://coder-server:8080/api/v2/organizations/{organization}/groups/ "name": "string", "status": "active", "theme_preference": "string", + "updated_at": "2019-08-24T14:15:22Z", "username": "string" } ], @@ -1726,6 +1733,7 @@ curl -X PATCH http://coder-server:8080/api/v2/scim/v2/Users/{id} \ ], "status": "active", "theme_preference": "string", + "updated_at": "2019-08-24T14:15:22Z", "username": "string" } ``` @@ -1782,6 +1790,7 @@ curl -X GET http://coder-server:8080/api/v2/templates/{template}/acl \ ], "status": "active", "theme_preference": "string", + "updated_at": "2019-08-24T14:15:22Z", "username": "string" } ] @@ -1815,6 +1824,7 @@ Status Code **200** | `»» organization_id` | string | false | | | | `» status` | [codersdk.UserStatus](schemas.md#codersdkuserstatus) | false | | | | `» theme_preference` | string | false | | | +| `» updated_at` | string(date-time) | false | | | | `» username` | string | true | | | #### Enumerated Values @@ -1937,6 +1947,7 @@ curl -X GET http://coder-server:8080/api/v2/templates/{template}/acl/available \ "name": "string", "status": "active", "theme_preference": "string", + "updated_at": "2019-08-24T14:15:22Z", "username": "string" } ], @@ -1957,6 +1968,7 @@ curl -X GET http://coder-server:8080/api/v2/templates/{template}/acl/available \ "name": "string", "status": "active", "theme_preference": "string", + "updated_at": "2019-08-24T14:15:22Z", "username": "string" } ] @@ -1991,6 +2003,7 @@ Status Code **200** | `»»» name` | string | false | | | | `»»» status` | [codersdk.UserStatus](schemas.md#codersdkuserstatus) | false | | | | `»»» theme_preference` | string | false | | | +| `»»» updated_at` | string(date-time) | false | | | | `»»» username` | string | true | | | | `»» name` | string | false | | | | `»» organization_id` | string(uuid) | false | | | diff --git a/docs/api/schemas.md b/docs/api/schemas.md index 01d07c770f6dc..d05827cb3d700 100644 --- a/docs/api/schemas.md +++ b/docs/api/schemas.md @@ -239,6 +239,7 @@ "name": "string", "status": "active", "theme_preference": "string", + "updated_at": "2019-08-24T14:15:22Z", "username": "string" } ], @@ -259,6 +260,7 @@ "name": "string", "status": "active", "theme_preference": "string", + "updated_at": "2019-08-24T14:15:22Z", "username": "string" } ] @@ -583,6 +585,7 @@ ], "status": "active", "theme_preference": "string", + "updated_at": "2019-08-24T14:15:22Z", "username": "string" }, "user_agent": "string" @@ -663,6 +666,7 @@ ], "status": "active", "theme_preference": "string", + "updated_at": "2019-08-24T14:15:22Z", "username": "string" }, "user_agent": "string" @@ -2688,6 +2692,7 @@ CreateWorkspaceRequest provides options for creating a new workspace. Only one o ], "status": "active", "theme_preference": "string", + "updated_at": "2019-08-24T14:15:22Z", "username": "string" } ] @@ -2739,6 +2744,7 @@ CreateWorkspaceRequest provides options for creating a new workspace. Only one o "name": "string", "status": "active", "theme_preference": "string", + "updated_at": "2019-08-24T14:15:22Z", "username": "string" } ], @@ -4043,6 +4049,7 @@ CreateWorkspaceRequest provides options for creating a new workspace. Only one o "name": "string", "status": "active", "theme_preference": "string", + "updated_at": "2019-08-24T14:15:22Z", "username": "string" } ``` @@ -4060,6 +4067,7 @@ CreateWorkspaceRequest provides options for creating a new workspace. Only one o | `name` | string | false | | | | `status` | [codersdk.UserStatus](#codersdkuserstatus) | false | | | | `theme_preference` | string | false | | | +| `updated_at` | string | false | | | | `username` | string | true | | | #### Enumerated Values @@ -4935,6 +4943,7 @@ CreateWorkspaceRequest provides options for creating a new workspace. Only one o ], "status": "active", "theme_preference": "string", + "updated_at": "2019-08-24T14:15:22Z", "username": "string" } ``` @@ -4955,6 +4964,7 @@ CreateWorkspaceRequest provides options for creating a new workspace. Only one o | `roles` | array of [codersdk.SlimRole](#codersdkslimrole) | false | | | | `status` | [codersdk.UserStatus](#codersdkuserstatus) | false | | | | `theme_preference` | string | false | | | +| `updated_at` | string | false | | | | `username` | string | true | | | #### Enumerated Values @@ -5564,6 +5574,7 @@ If the schedule is empty, the user will be updated to use the default schedule.| ], "status": "active", "theme_preference": "string", + "updated_at": "2019-08-24T14:15:22Z", "username": "string" } ``` @@ -5583,6 +5594,7 @@ If the schedule is empty, the user will be updated to use the default schedule.| | `roles` | array of [codersdk.SlimRole](#codersdkslimrole) | false | | | | `status` | [codersdk.UserStatus](#codersdkuserstatus) | false | | | | `theme_preference` | string | false | | | +| `updated_at` | string | false | | | | `username` | string | true | | | #### Enumerated Values diff --git a/docs/api/users.md b/docs/api/users.md index ac3305af96c86..5b521183fcd23 100644 --- a/docs/api/users.md +++ b/docs/api/users.md @@ -48,6 +48,7 @@ curl -X GET http://coder-server:8080/api/v2/users \ ], "status": "active", "theme_preference": "string", + "updated_at": "2019-08-24T14:15:22Z", "username": "string" } ] @@ -119,6 +120,7 @@ curl -X POST http://coder-server:8080/api/v2/users \ ], "status": "active", "theme_preference": "string", + "updated_at": "2019-08-24T14:15:22Z", "username": "string" } ``` @@ -391,6 +393,7 @@ curl -X GET http://coder-server:8080/api/v2/users/{user} \ ], "status": "active", "theme_preference": "string", + "updated_at": "2019-08-24T14:15:22Z", "username": "string" } ``` @@ -481,6 +484,7 @@ curl -X PUT http://coder-server:8080/api/v2/users/{user}/appearance \ ], "status": "active", "theme_preference": "string", + "updated_at": "2019-08-24T14:15:22Z", "username": "string" } ``` @@ -1142,6 +1146,7 @@ curl -X PUT http://coder-server:8080/api/v2/users/{user}/profile \ ], "status": "active", "theme_preference": "string", + "updated_at": "2019-08-24T14:15:22Z", "username": "string" } ``` @@ -1196,6 +1201,7 @@ curl -X GET http://coder-server:8080/api/v2/users/{user}/roles \ ], "status": "active", "theme_preference": "string", + "updated_at": "2019-08-24T14:15:22Z", "username": "string" } ``` @@ -1260,6 +1266,7 @@ curl -X PUT http://coder-server:8080/api/v2/users/{user}/roles \ ], "status": "active", "theme_preference": "string", + "updated_at": "2019-08-24T14:15:22Z", "username": "string" } ``` @@ -1314,6 +1321,7 @@ curl -X PUT http://coder-server:8080/api/v2/users/{user}/status/activate \ ], "status": "active", "theme_preference": "string", + "updated_at": "2019-08-24T14:15:22Z", "username": "string" } ``` @@ -1368,6 +1376,7 @@ curl -X PUT http://coder-server:8080/api/v2/users/{user}/status/suspend \ ], "status": "active", "theme_preference": "string", + "updated_at": "2019-08-24T14:15:22Z", "username": "string" } ``` diff --git a/docs/cli/users_list.md b/docs/cli/users_list.md index 3ffda880c6dc6..1a7a10b20d057 100644 --- a/docs/cli/users_list.md +++ b/docs/cli/users_list.md @@ -21,7 +21,7 @@ coder users list [flags] | Type | string-array | | Default | username,email,created_at,status | -Columns to display in table output. Available columns: id, username, email, created at, status. +Columns to display in table output. Available columns: id, username, email, created at, updated at, status. ### -o, --output diff --git a/site/src/api/typesGenerated.ts b/site/src/api/typesGenerated.ts index 34b3285f1603b..da0ef1b684ff7 100644 --- a/site/src/api/typesGenerated.ts +++ b/site/src/api/typesGenerated.ts @@ -1005,6 +1005,7 @@ export interface ReducedUser extends MinimalUser { readonly name: string; readonly email: string; readonly created_at: string; + readonly updated_at: string; readonly last_seen_at: string; readonly status: UserStatus; readonly login_type: LoginType; diff --git a/site/src/pages/UserSettingsPage/AccountPage/AccountPage.test.tsx b/site/src/pages/UserSettingsPage/AccountPage/AccountPage.test.tsx index 7687e95e90a49..1fb006bf33e67 100644 --- a/site/src/pages/UserSettingsPage/AccountPage/AccountPage.test.tsx +++ b/site/src/pages/UserSettingsPage/AccountPage/AccountPage.test.tsx @@ -30,6 +30,7 @@ describe("AccountPage", () => { id: userId, email: "user@coder.com", created_at: new Date().toISOString(), + updated_at: new Date().toISOString(), status: "active", organization_ids: ["123"], roles: [], diff --git a/site/src/testHelpers/entities.ts b/site/src/testHelpers/entities.ts index 85c9fcbd66e51..e5ff96ec7ea44 100644 --- a/site/src/testHelpers/entities.ts +++ b/site/src/testHelpers/entities.ts @@ -307,6 +307,7 @@ export const MockUser: TypesGen.User = { username: "TestUser", email: "test@coder.com", created_at: "", + updated_at: "", status: "active", organization_ids: [MockOrganization.id], roles: [MockOwnerRole], @@ -322,6 +323,7 @@ export const MockUserAdmin: TypesGen.User = { username: "TestUser", email: "test@coder.com", created_at: "", + updated_at: "", status: "active", organization_ids: [MockOrganization.id], roles: [MockUserAdminRole], @@ -337,6 +339,7 @@ export const MockUser2: TypesGen.User = { username: "TestUser2", email: "test2@coder.com", created_at: "", + updated_at: "", status: "active", organization_ids: [MockOrganization.id], roles: [], @@ -352,6 +355,7 @@ export const SuspendedMockUser: TypesGen.User = { username: "SuspendedMockUser", email: "iamsuspendedsad!@coder.com", created_at: "", + updated_at: "", status: "suspended", organization_ids: [MockOrganization.id], roles: [],