Skip to content

Commit

Permalink
update search to include maintenance mode (#3341)
Browse files Browse the repository at this point in the history
  • Loading branch information
KatieMSB committed Oct 5, 2023
1 parent 51eec74 commit cc7c496
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions service/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ var searchTemplate = template.Must(template.New("search").Funcs(search.Helpers()
svc.name,
svc.description,
svc.escalation_policy_id,
fav IS DISTINCT FROM NULL
fav IS DISTINCT FROM NULL,
svc.maintenance_expires_at
FROM services svc
{{if not .FavoritesOnly }}LEFT {{end}}JOIN user_favorites fav ON svc.id = fav.tgt_service_id AND {{if .FavoritesUserID}}fav.user_id = :favUserID{{else}}false{{end}}
{{if and .IntegrationKey}}
Expand Down Expand Up @@ -234,10 +235,12 @@ func (s *Store) Search(ctx context.Context, opts *SearchOptions) ([]Service, err
var result []Service
for rows.Next() {
var s Service
err = rows.Scan(&s.ID, &s.Name, &s.Description, &s.EscalationPolicyID, &s.isUserFavorite)
var maintExpiresAt sql.NullTime
err = rows.Scan(&s.ID, &s.Name, &s.Description, &s.EscalationPolicyID, &s.isUserFavorite, &maintExpiresAt)
if err != nil {
return nil, err
}
s.MaintenanceExpiresAt = maintExpiresAt.Time

result = append(result, s)
}
Expand Down

0 comments on commit cc7c496

Please sign in to comment.