Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

services: update query to return maintenance_expires_at #3341

Merged
merged 1 commit into from
Oct 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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