Skip to content

Commit

Permalink
refactor: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
HeavyPunk committed Feb 5, 2025
1 parent b07a8ee commit b739af3
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion api/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (WebConfig) Render(http.ResponseWriter, *http.Request) error {
const (
// DefaultTriggerNameMaxSize which will be used while validating dto.Trigger.
DefaultTriggerNameMaxSize = 200
DefaultTriggerPagerTTL = time.Minute * 30
DefaultTriggerPagerTTL = time.Minute * 30
)

// PagerLimits contains all limits applied for pagers.
Expand Down
15 changes: 7 additions & 8 deletions api/handler/triggers.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,13 +304,12 @@ func triggerCheck(writer http.ResponseWriter, request *http.Request) {
// @tags trigger
// @produce json
// @param onlyProblems query boolean false "Only include problems" default(false)
// @param text query string false "Search text" default(cpu)
// @param p query integer false "Page number" default(0)
// @param size query integer false "Page size" default(10)
// @param createPager query boolean false "Create pager" default(false)
// @param pagerID query string false "Pager ID" default(bcba82f5-48cf-44c0-b7d6-e1d32c64a88c)
// @param pagerTTL query time.Duration false "Pager TTL" default(30m)
// @param createdBy query string false "Created By" default(moira.team)
// @param text query string false "Search text" default(cpu)
// @param p query integer false "Page number" default(0)
// @param size query integer false "Page size" default(10)
// @param createPager query boolean false "Create pager" default(false)
// @param pagerID query string false "Pager ID" default(bcba82f5-48cf-44c0-b7d6-e1d32c64a88c)
// @param createdBy query string false "Created By" default(moira.team)
// @success 200 {object} dto.TriggersList "Successfully fetched matching triggers"
// @failure 400 {object} api.ErrorInvalidRequestExample "Bad request from client"
// @failure 404 {object} api.ErrorNotFoundExample "Resource not found"
Expand All @@ -331,7 +330,7 @@ func searchTriggers(writer http.ResponseWriter, request *http.Request) {
NeedSearchByCreatedBy: ok,
CreatePager: middleware.GetCreatePager(request),
PagerID: middleware.GetPagerID(request),
PagerTTL: middleware.GetPagerTTL(request),
PagerTTL: middleware.GetPagerTTL(request),
}

triggersList, errorResponse := controller.SearchTriggers(database, searchIndex, searchOptions)
Expand Down
2 changes: 1 addition & 1 deletion api/middleware/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var (
pageKey ContextKey = "page"
sizeKey ContextKey = "size"
pagerIDKey ContextKey = "pagerID"
pagerTTLKey ContextKey = "pagerTTL"
pagerTTLKey ContextKey = "pagerTTL"
createPagerKey ContextKey = "createPager"
fromKey ContextKey = "from"
toKey ContextKey = "to"
Expand Down
2 changes: 2 additions & 0 deletions cmd/api/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ type LimitsConfig struct {
Team TeamLimitsConfig `yaml:"team"`
}

// PagerLimits represents the limits which will be applied to all pagers.
type PagerLimits struct {
// TTL is the amount of time that the pager will be exist
TTL time.Duration `yaml:"ttl"`
}

Expand Down
2 changes: 1 addition & 1 deletion datatypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ type SearchOptions struct {
NeedSearchByCreatedBy bool
CreatePager bool
PagerID string
PagerTTL time.Duration
PagerTTL time.Duration
}

// MaintenanceCheck set maintenance user, time.
Expand Down

0 comments on commit b739af3

Please sign in to comment.