aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/ical
diff options
context:
space:
mode:
authorLeonardo Bishop <me@leonardobishop.com>2025-08-23 22:29:28 +0100
committerLeonardo Bishop <me@leonardobishop.com>2025-08-23 22:29:28 +0100
commitecc6a55aba7bb35fc778e7a53848396b88214151 (patch)
tree1b37a2dc5f4594155114da1ae0c4529d20a4c548 /pkg/ical
parent8f7dec8ba6b2f9bde01afd0a110596ebbd43e0ed (diff)
Add multiple conferences feature
Diffstat (limited to 'pkg/ical')
-rw-r--r--pkg/ical/service.go17
1 files changed, 10 insertions, 7 deletions
diff --git a/pkg/ical/service.go b/pkg/ical/service.go
index d93c846..bc82248 100644
--- a/pkg/ical/service.go
+++ b/pkg/ical/service.go
@@ -6,9 +6,9 @@ import (
"strings"
"time"
+ "github.com/LMBishop/confplanner/pkg/conference"
"github.com/LMBishop/confplanner/pkg/database/sqlc"
"github.com/LMBishop/confplanner/pkg/favourites"
- "github.com/LMBishop/confplanner/pkg/schedule"
"github.com/microcosm-cc/bluemonday"
)
@@ -23,28 +23,31 @@ var (
type service struct {
favouritesService favourites.Service
- scheduleService schedule.Service
+ conferenceService conference.Service
}
func NewService(
favouritesService favourites.Service,
- scheduleService schedule.Service,
+ conferenceService conference.Service,
) Service {
return &service{
favouritesService: favouritesService,
- scheduleService: scheduleService,
+ conferenceService: conferenceService,
}
}
func (s *service) GenerateIcalForCalendar(calendar sqlc.Calendar) (string, error) {
- favourites, err := s.favouritesService.GetFavouritesForUser(calendar.UserID)
+ favourites, err := s.favouritesService.GetAllFavouritesForUser(calendar.UserID)
if err != nil {
return "", err
}
- events := make([]schedule.Event, 0)
+ events := make([]conference.Event, 0)
for _, favourite := range *favourites {
- event := s.scheduleService.GetEventByID(favourite.EventID.Int32)
+ event, err := s.conferenceService.GetEventByID(favourite.ConferenceID, favourite.EventID.Int32)
+ if err != nil {
+ continue
+ }
events = append(events, *event)
}