diff --git a/services/data-manager/service/grpc/roomService.go b/services/data-manager/service/grpc/roomService.go index e71b6cf..5701e76 100644 --- a/services/data-manager/service/grpc/roomService.go +++ b/services/data-manager/service/grpc/roomService.go @@ -5,7 +5,6 @@ import ( "github.com/pocketbase/pocketbase" pb "htwkalender/common/genproto/modules" "htwkalender/data-manager/service/db" - "log/slog" ) type RoomServiceHandler struct { @@ -19,9 +18,6 @@ func (s *RoomServiceHandler) GetRoomEvents(ctx context.Context, in *pb.GetRoomRe "Protobuf - GetRoomEvents", "room", in.Room, ) - - slog.Error("GetRoomEvents", "room", in.Room) - // get events from database by room events, err := db.GetRoomSchedule(s.app, in.Room) if err != nil { diff --git a/services/ical/service/ical/ical.go b/services/ical/service/ical/ical.go index eaf381a..dd8b8b2 100644 --- a/services/ical/service/ical/ical.go +++ b/services/ical/service/ical/ical.go @@ -107,7 +107,7 @@ func CreateFeed(app model.AppType, modules []model.FeedCollection) (string, erro return token, nil } -func FeedRoom(app model.AppType, room string) (string, string, error) { +func FeedRoom(app model.AppType, room string, userAgent string) (string, string, error) { // Get all events for room events, err := htwkalenderGrpc.GetEventsByRoom(room, app.GrpcClient) @@ -121,7 +121,7 @@ func FeedRoom(app model.AppType, room string) (string, string, error) { // Generate one Hash for E-TAG from all events etag := functions.HashString(events.String()) - cal := GenerateIcalFeed(events, map[string]model.FeedCollection{}, "") + cal := GenerateIcalFeed(events, map[string]model.FeedCollection{}, userAgent) icalFeed := &model.FeedModel{Content: cal.Serialize(), ExpiresAt: model.JSONTime(time.Now().Add(expirationTime))} return icalFeed.Content, etag, nil diff --git a/services/ical/service/routes.go b/services/ical/service/routes.go index 882194b..18c35bf 100644 --- a/services/ical/service/routes.go +++ b/services/ical/service/routes.go @@ -123,8 +123,9 @@ func AddFeedRoutes(app model.AppType) { app.Fiber.Get("/api/feed/room", func(c fiber.Ctx) error { room := c.Query("id") ifNoneMatch := c.Get("If-None-Match") + userAgent := c.Get("User-Agent") - results, etag, err := ical.FeedRoom(app, room) + results, etag, err := ical.FeedRoom(app, room, userAgent) if err != nil { slog.Error("Failed to get feed", "error", err, "room", room) return c.SendStatus(fiber.StatusNotFound) @@ -144,10 +145,12 @@ func AddFeedRoutes(app model.AppType) { app.Fiber.Head("/api/feed", func(c fiber.Ctx) error { return c.JSON(http.StatusOK, "") }) + app.Fiber.Head("/api/feed/room", func(c fiber.Ctx) error { return c.JSON(http.StatusOK, "") }) app.Fiber.Add([]string{"PROPFIND"}, "/api/feed", func(c fiber.Ctx) error { return c.JSON(http.StatusOK, "") }) + app.Fiber.Add([]string{"PROPFIND"}, "/api/feed/room", func(c fiber.Ctx) error { return c.JSON(http.StatusOK, "") }) // Route for Thunderbird to get calendar server information // Response is a 200 OK without additional content