mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2025-08-07 12:19:14 +02:00
feat:#16 added room ics api route
This commit is contained in:
@@ -25,7 +25,7 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
func GetEvents(modules []model.FeedModule, conn *grpc.ClientConn) (model.Events, error) {
|
||||
func GetEventsByModules(modules []model.FeedModule, conn *grpc.ClientConn) (model.Events, error) {
|
||||
c := pb.NewModuleServiceClient(conn)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
|
||||
defer cancel()
|
||||
@@ -48,3 +48,21 @@ func GetEvents(modules []model.FeedModule, conn *grpc.ClientConn) (model.Events,
|
||||
|
||||
return events, nil
|
||||
}
|
||||
|
||||
func GetEventsByRoom(room string, conn *grpc.ClientConn) (model.Events, error) {
|
||||
c := pb.NewRoomServiceClient(conn)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
|
||||
defer cancel()
|
||||
|
||||
r, err := c.GetRoomEvents(ctx, &pb.GetRoomRequest{Room: room})
|
||||
if err != nil {
|
||||
slog.Error("could not get room events: ", "error", err)
|
||||
}
|
||||
|
||||
events := make(model.Events, 0)
|
||||
for _, event := range r.GetEvents() {
|
||||
events = append(events, protoToEvent(event))
|
||||
}
|
||||
|
||||
return events, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user