mirror of
https://github.com/coder/coder.git
synced 2026-10-29 17:44:33 +08:00
feat(coderd/database): track user status changes over time (#16019)
RE: https://github.com/coder/coder/issues/15740, https://github.com/coder/coder/issues/15297 In order to add a graph to the coder frontend to show user status over time as an indicator of license usage, this PR adds the following: * a new `api.insightsUserStatusCountsOverTime` endpoint to the API * which calls a new `GetUserStatusCountsOverTime` query from postgres * which relies on two new tables `user_status_changes` and `user_deleted` * which are populated by a new trigger and function that tracks updates to the users table The chart itself will be added in a subsequent PR --------- Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
This commit is contained in:
co-authored by
Mathias Fredriksson
parent
73d8dde6ed
commit
4543b21b7c
Generated
+44
@@ -3000,6 +3000,34 @@ Git clone makes use of this by parsing the URL from: 'Username for "https://gith
|
||||
|-------|--------|----------|--------------|-------------|
|
||||
| `key` | string | false | | |
|
||||
|
||||
## codersdk.GetUserStatusCountsResponse
|
||||
|
||||
```json
|
||||
{
|
||||
"status_counts": {
|
||||
"property1": [
|
||||
{
|
||||
"count": 10,
|
||||
"date": "2019-08-24T14:15:22Z"
|
||||
}
|
||||
],
|
||||
"property2": [
|
||||
{
|
||||
"count": 10,
|
||||
"date": "2019-08-24T14:15:22Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Properties
|
||||
|
||||
| Name | Type | Required | Restrictions | Description |
|
||||
|--------------------|---------------------------------------------------------------------------|----------|--------------|-------------|
|
||||
| `status_counts` | object | false | | |
|
||||
| » `[any property]` | array of [codersdk.UserStatusChangeCount](#codersdkuserstatuschangecount) | false | | |
|
||||
|
||||
## codersdk.GetUsersResponse
|
||||
|
||||
```json
|
||||
@@ -6724,6 +6752,22 @@ If the schedule is empty, the user will be updated to use the default schedule.|
|
||||
| `dormant` |
|
||||
| `suspended` |
|
||||
|
||||
## codersdk.UserStatusChangeCount
|
||||
|
||||
```json
|
||||
{
|
||||
"count": 10,
|
||||
"date": "2019-08-24T14:15:22Z"
|
||||
}
|
||||
```
|
||||
|
||||
### Properties
|
||||
|
||||
| Name | Type | Required | Restrictions | Description |
|
||||
|---------|---------|----------|--------------|-------------|
|
||||
| `count` | integer | false | | |
|
||||
| `date` | string | false | | |
|
||||
|
||||
## codersdk.ValidateUserPasswordRequest
|
||||
|
||||
```json
|
||||
|
||||
Reference in New Issue
Block a user