Skip to content

Commit 056918e

Browse files
committed
remove interval none
1 parent bffc673 commit 056918e

File tree

6 files changed

+17
-34
lines changed

6 files changed

+17
-34
lines changed

coderd/apidoc/docs.go

Lines changed: 1 addition & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

Lines changed: 3 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/insights.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ func (api *API) insightsTemplates(rw http.ResponseWriter, r *http.Request) {
196196
// to parse the time ourselves.
197197
startTimeString = p.String(vals, "", "start_time")
198198
endTimeString = p.String(vals, "", "end_time")
199-
intervalString = p.String(vals, string(codersdk.InsightsReportIntervalNone), "interval")
199+
intervalString = p.String(vals, "", "interval")
200200
templateIDs = p.UUIDs(vals, []uuid.UUID{}, "template_ids")
201201
)
202202
p.ErrorExcessParams(vals)
@@ -224,7 +224,7 @@ func (api *API) insightsTemplates(rw http.ResponseWriter, r *http.Request) {
224224
err := api.Database.InTx(func(db database.Store) error {
225225
var err error
226226

227-
if interval != codersdk.InsightsReportIntervalNone {
227+
if interval != "" {
228228
dailyUsage, err = db.GetTemplateDailyInsights(ctx, database.GetTemplateDailyInsightsParams{
229229
StartTime: startTime,
230230
EndTime: endTime,
@@ -435,15 +435,15 @@ func parseInsightsStartAndEndTime(ctx context.Context, rw http.ResponseWriter, s
435435

436436
func verifyInsightsInterval(ctx context.Context, rw http.ResponseWriter, intervalString string) (codersdk.InsightsReportInterval, bool) {
437437
switch v := codersdk.InsightsReportInterval(intervalString); v {
438-
case codersdk.InsightsReportIntervalDay, codersdk.InsightsReportIntervalNone:
438+
case codersdk.InsightsReportIntervalDay, "":
439439
return v, true
440440
default:
441441
httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{
442442
Message: "Query parameter has invalid value.",
443443
Validations: []codersdk.ValidationError{
444444
{
445445
Field: "interval",
446-
Detail: fmt.Sprintf("must be one of %v", []codersdk.InsightsReportInterval{codersdk.InsightsReportIntervalNone, codersdk.InsightsReportIntervalDay}),
446+
Detail: fmt.Sprintf("must be one of %v", []codersdk.InsightsReportInterval{codersdk.InsightsReportIntervalDay}),
447447
},
448448
},
449449
})

codersdk/insights.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ type InsightsReportInterval string
2121

2222
// InsightsReportInterval enums.
2323
const (
24-
InsightsReportIntervalNone InsightsReportInterval = "none"
25-
InsightsReportIntervalDay InsightsReportInterval = "day"
24+
InsightsReportIntervalDay InsightsReportInterval = "day"
2625
)
2726

2827
// UserLatencyInsightsResponse is the response from the user latency insights
@@ -109,7 +108,7 @@ type TemplateInsightsIntervalReport struct {
109108
StartTime time.Time `json:"start_time" format:"date-time"`
110109
EndTime time.Time `json:"end_time" format:"date-time"`
111110
TemplateIDs []uuid.UUID `json:"template_ids" format:"uuid"`
112-
Interval InsightsReportInterval `json:"interval" example:"day"`
111+
Interval InsightsReportInterval `json:"interval"`
113112
ActiveUsers int64 `json:"active_users" example:"14"`
114113
}
115114

@@ -157,7 +156,7 @@ type TemplateInsightsRequest struct {
157156
StartTime time.Time `json:"start_time" format:"date-time"`
158157
EndTime time.Time `json:"end_time" format:"date-time"`
159158
TemplateIDs []uuid.UUID `json:"template_ids" format:"uuid"`
160-
Interval InsightsReportInterval `json:"interval" example:"day"`
159+
Interval InsightsReportInterval `json:"interval"`
161160
}
162161

163162
func (c *Client) TemplateInsights(ctx context.Context, req TemplateInsightsRequest) (TemplateInsightsResponse, error) {

docs/api/schemas.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2914,17 +2914,16 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
29142914
## codersdk.InsightsReportInterval
29152915

29162916
```json
2917-
"none"
2917+
"day"
29182918
```
29192919

29202920
### Properties
29212921

29222922
#### Enumerated Values
29232923

2924-
| Value |
2925-
| ------ |
2926-
| `none` |
2927-
| `day` |
2924+
| Value |
2925+
| ----- |
2926+
| `day` |
29282927

29292928
## codersdk.IssueReconnectingPTYSignedTokenRequest
29302929

site/src/api/typesGenerated.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,8 +1590,8 @@ export const GitProviders: GitProvider[] = [
15901590
]
15911591

15921592
// From codersdk/insights.go
1593-
export type InsightsReportInterval = "day" | "none"
1594-
export const InsightsReportIntervals: InsightsReportInterval[] = ["day", "none"]
1593+
export type InsightsReportInterval = "day"
1594+
export const InsightsReportIntervals: InsightsReportInterval[] = ["day"]
15951595

15961596
// From codersdk/provisionerdaemons.go
15971597
export type JobErrorCode =

0 commit comments

Comments
 (0)