From f8903675f3949bcfe6354bd9e6975f97aff15d62 Mon Sep 17 00:00:00 2001 From: KatriannaSydlik-Badgerow Date: Wed, 4 Oct 2023 15:20:30 -0500 Subject: [PATCH] update search to include maintenance mode --- service/search.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/service/search.go b/service/search.go index b198e05a80..b2b00b0f36 100644 --- a/service/search.go +++ b/service/search.go @@ -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}} @@ -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) }