aboutsummaryrefslogtreecommitdiffstats
path: root/api/router.go
diff options
context:
space:
mode:
authorLeonardo Bishop <me@leonardobishop.com>2025-01-20 02:56:25 +0000
committerLeonardo Bishop <me@leonardobishop.com>2025-01-20 02:56:25 +0000
commitdc55f9c0097e1c36b85d7666071b840b902920e9 (patch)
treec8c8ae10a9e134810b3361aabc8a9d426d813808 /api/router.go
parent5e7ce6cbae81a1b6e46fe6738dc10039a06bec95 (diff)
Add calendar support
Diffstat (limited to 'api/router.go')
-rw-r--r--api/router.go11
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
}