diff options
| author | Leonardo Bishop <me@leonardobishop.com> | 2025-08-14 18:07:12 +0100 |
|---|---|---|
| committer | Leonardo Bishop <me@leonardobishop.com> | 2025-08-14 18:07:12 +0100 |
| commit | 4697556cac819c47d068819b9fc9c3b4ea84e279 (patch) | |
| tree | b832d8fc6b643a8b9d0eeca35c1268e1649da731 /api/handlers/schedule.go | |
| parent | dd49c9205bb04844b686b9c3396c40eb49d25826 (diff) | |
Merge confplanner-web and replace fiber with native net/http
Diffstat (limited to 'api/handlers/schedule.go')
| -rw-r--r-- | api/handlers/schedule.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/api/handlers/schedule.go b/api/handlers/schedule.go index 46589ab..061e6f9 100644 --- a/api/handlers/schedule.go +++ b/api/handlers/schedule.go @@ -1,25 +1,26 @@ package handlers import ( + "net/http" + "github.com/LMBishop/confplanner/api/dto" "github.com/LMBishop/confplanner/pkg/schedule" - "github.com/gofiber/fiber/v2" "github.com/golang-cz/nilslice" ) -func GetSchedule(service schedule.Service) fiber.Handler { - return func(c *fiber.Ctx) error { +func GetSchedule(service schedule.Service) http.HandlerFunc { + return dto.WrapResponseFunc(func(w http.ResponseWriter, r *http.Request) error { schedule, lastUpdated, err := service.GetSchedule() if err != nil { return err } return &dto.OkResponse{ - Code: fiber.StatusOK, + Code: http.StatusOK, Data: &dto.GetScheduleResponse{ Schedule: nilslice.Initialize(*schedule), LastUpdated: lastUpdated, }, } - } + }) } |
