mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2025-08-03 10:19:14 +02:00
feat:#16 added room ics api route
This commit is contained in:
@@ -94,7 +94,7 @@ func GetRoomScheduleForDay(app *pocketbase.PocketBase, room string, date string)
|
||||
return events, nil
|
||||
}
|
||||
|
||||
func GetRoomSchedule(app *pocketbase.PocketBase, room string, from string, to string) ([]model.Event, error) {
|
||||
func GetRoomScheduleInTimeSpan(app *pocketbase.PocketBase, room string, from string, to string) ([]model.Event, error) {
|
||||
var events []model.Event
|
||||
|
||||
fromDate, err := time.Parse("2006-01-02", from)
|
||||
@@ -118,3 +118,17 @@ func GetRoomSchedule(app *pocketbase.PocketBase, room string, from string, to st
|
||||
}
|
||||
return events, nil
|
||||
}
|
||||
|
||||
func GetRoomSchedule(app *pocketbase.PocketBase, room string) ([]model.Event, error) {
|
||||
var events []model.Event
|
||||
|
||||
// get all events from event records in the events collection
|
||||
err := app.Dao().DB().Select("*").From("events").
|
||||
Where(dbx.Like("Rooms", room).Escape("_", "_")).
|
||||
GroupBy("Week", "Start", "End", "Rooms").
|
||||
All(&events)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return events, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user