Get all bookings
Some checks failed
Build and Push Docker Image / build_and_push (push) Failing after 44s

This commit is contained in:
2025-04-15 10:25:02 +02:00
parent 4718de6c80
commit 575b8129b7
8 changed files with 743 additions and 398 deletions

View File

@@ -280,6 +280,29 @@ func (s MongoDBStorage) GetUserBookings(userid string) ([]internal.Booking, erro
return bookings, nil
}
func (s MongoDBStorage) GetAllBookings() ([]internal.Booking, error) {
findOptions := options.Find()
collection := s.Client.Database(s.DbName).Collection(s.Collections["bookings"])
cur, err := collection.Find(context.TODO(), bson.M{}, findOptions)
if err != nil {
return nil, err
}
var bookings []internal.Booking
for cur.Next(context.TODO()) {
var elem internal.Booking
if err := cur.Decode(&elem); err != nil {
log.Error().Err(err).Msg("error reading bookings response")
return nil, err
}
bookings = append(bookings, elem)
}
return bookings, nil
}
func (s MongoDBStorage) UpdateBookingStatus(bookingid string, status string) error {
// TODO implement UpdateBookingStatus
return errors.New("MongoDB Storage - UpdateBookingStatus not implemented")