daddy/internal/graph/event_handler.go

25 lines
519 B
Go
Raw Normal View History

package graph
import (
"context"
"forge.cadoles.com/Cadoles/daddy/internal/model"
"forge.cadoles.com/Cadoles/daddy/internal/orm"
errs "github.com/pkg/errors"
"gitlab.com/wpetit/goweb/middleware/container"
)
func handleEvents(ctx context.Context, filter *model.EventFilter) ([]*model.Event, error) {
ctn := container.Must(ctx)
db := orm.Must(ctn).DB()
repo := model.NewEventRepository(db)
events, err := repo.Search(ctx, filter)
if err != nil {
return nil, errs.WithStack(err)
}
return events, nil
}