added api for room and day check

This commit is contained in:
Elmar Kresse
2023-09-21 01:29:55 +02:00
parent 89fa8d682a
commit 47adb18359
3 changed files with 36 additions and 0 deletions

View File

@@ -118,6 +118,18 @@ func GetRooms(app *pocketbase.PocketBase) []string {
return roomArray
}
func GetRoomScheduleForDay(app *pocketbase.PocketBase, room string, date string) []model.Event {
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)).AndWhere(dbx.Like("Start", date)).All(&events)
if err != nil {
print("Error while getting events from database: ", err)
return nil
}
return events
}
type Events []*model.Event
// EmitICal implements the interface for goics