diff options
Diffstat (limited to 'api/router.go')
| -rw-r--r-- | api/router.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/api/router.go b/api/router.go index 82a29b1..dc7e487 100644 --- a/api/router.go +++ b/api/router.go @@ -8,7 +8,9 @@ import ( "github.com/LMBishop/confplanner/api/dto" "github.com/LMBishop/confplanner/api/handlers" "github.com/LMBishop/confplanner/api/middleware" + "github.com/LMBishop/confplanner/pkg/calendar" "github.com/LMBishop/confplanner/pkg/favourites" + "github.com/LMBishop/confplanner/pkg/ical" "github.com/LMBishop/confplanner/pkg/schedule" "github.com/LMBishop/confplanner/pkg/user" "github.com/gofiber/fiber/v2" @@ -19,9 +21,11 @@ type ApiServices struct { UserService user.Service FavouritesService favourites.Service ScheduleService schedule.Service + CalendarService calendar.Service + IcalService ical.Service } -func NewServer(apiServices ApiServices) *fiber.App { +func NewServer(apiServices ApiServices, baseURL string) *fiber.App { sessionStore := session.New(session.Config{ Expiration: 24 * time.Hour, KeyLookup: "cookie:confplanner_session", @@ -63,5 +67,10 @@ func NewServer(apiServices ApiServices) *fiber.App { app.Get("/schedule", requireAuthenticated, handlers.GetSchedule(apiServices.ScheduleService)) + app.Get("/calendar", requireAuthenticated, handlers.GetCalendar(apiServices.CalendarService, baseURL)) + app.Post("/calendar", requireAuthenticated, handlers.CreateCalendar(apiServices.CalendarService, baseURL)) + app.Delete("/calendar", requireAuthenticated, handlers.DeleteCalendar(apiServices.CalendarService)) + app.Use("/calendar/ical", handlers.GetIcal(apiServices.IcalService, apiServices.CalendarService)) + return app } |
