Wire active alert filtering into HTTP
This commit is contained in:
@@ -4,6 +4,7 @@ package httpapi
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"gitea.maximumdirect.net/ejr/feedapi/endpoint"
|
||||
"gitea.maximumdirect.net/ejr/feedapi/render"
|
||||
@@ -11,12 +12,14 @@ import (
|
||||
"gitea.maximumdirect.net/ejr/weatherapi/internal/adapters/inbound/httpapi/presenter"
|
||||
)
|
||||
|
||||
var alertNow = time.Now
|
||||
|
||||
func alertsDefinition(svc Service) endpoint.Definition {
|
||||
return endpoint.GET(
|
||||
"/alerts/active",
|
||||
bindQuery,
|
||||
func(ctx context.Context, req queryRequest) (any, error) {
|
||||
run, err := svc.LatestAlertRun(ctx)
|
||||
run, err := svc.LatestActiveAlertRun(ctx, alertNow().UTC())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user