Beispiel #1
0
 def get_free_tables(self, seats: int, since: datetime, until: datetime):
     return (DBEngine.get_session().query(Table).join(
         Schedule, Schedule.StulID == Table.StulID).filter(
             Table.Pocetmist >= seats,
             cast(Schedule.Datumod, DateTime) <= since,
             cast(Schedule.Datumdo, DateTime) >= until,
             Schedule.Jedostupny == True).all())
Beispiel #2
0
 def get(self, obj_id: int):
     return DBEngine.get_session().query(Table).filter(
         Table.StulID == obj_id).first()
Beispiel #3
0
 def delete(self, obj: Address):
     if not self.get(obj.AdresaID):
         return False
     DBEngine.get_session().delete(obj)
     DBEngine.get_session().commit()
     return True
Beispiel #4
0
 def get(self, obj_id: int):
     return DBEngine.get_session().query(Address).filter(
         Address.AdresaID == obj_id).first()
Beispiel #5
0
 def delete(self, obj: Reservation):
     if not self.get(obj.RezervaceID):
         return False
     DBEngine.get_session().delete(obj)
     DBEngine.get_session().commit()
     return True
Beispiel #6
0
 def get(self, obj_id: int):
     return DBEngine.get_session().query(Reservation).filter(
         Reservation.RezervaceID == obj_id).first()
Beispiel #7
0
 def delete(self, obj: Alergen):
     if not self.get(obj.Cislo):
         return False
     DBEngine.get_session().delete(obj)
     DBEngine.get_session().commit()
     return True
Beispiel #8
0
 def get(self, obj_id: int):
     return DBEngine.get_session().query(Alergen).filter(
         Alergen.Cislo == obj_id).first()
Beispiel #9
0
 def get_all(self):
     schedules = DBEngine.get_session().query(Schedule).all()
     return schedules
Beispiel #10
0
 def delete(self, obj: Schedule):
     if not self.get(obj.RozvrhID):
         return False
     DBEngine.get_session().delete(obj)
     DBEngine.get_session().commit()
     return True
Beispiel #11
0
 def add(self, obj: Schedule):
     if self.get(obj.RozvrhID):
         return False
     DBEngine.get_session().add(obj)
     DBEngine.get_session().commit()
     return True
Beispiel #12
0
 def get(self, obj_id: int):
     return DBEngine.get_session().query(Schedule).filter(
         Schedule.RozvrhID == obj_id).first()
Beispiel #13
0
 def delete(self, obj: Table):
     if not self.get(obj.StulID):
         return False
     DBEngine.get_session().delete(obj)
     DBEngine.get_session().commit()
     return True
Beispiel #14
0
 def add(self, obj: Table):
     if self.get(obj.StulID):
         return False
     DBEngine.get_session().add(obj)
     DBEngine.get_session().commit()
     return True
Beispiel #15
0
 def delete(self, obj: Meal):
     if not self.get(obj.JidloID):
         return False
     DBEngine.get_session().delete(obj)
     DBEngine.get_session().commit()
     return True
Beispiel #16
0
 def get(self, obj_id: int):
     return DBEngine.get_session().query(Customer).filter(
         Customer.UzivatelID == obj_id).first()
Beispiel #17
0
 def get_all(self):
     meals = DBEngine.get_session().query(Meal).all()
     return meals
Beispiel #18
0
 def add(self, obj: Customer):
     if self.get(obj.UzivatelID):
         return False
     DBEngine.get_session().add(obj)
     DBEngine.get_session().commit()
     return True
Beispiel #19
0
 def add(self, obj: Alergen):
     if self.get(obj.Cislo):
         return False
     DBEngine.get_session().add(obj)
     DBEngine.get_session().commit()
     return True
Beispiel #20
0
 def delete(self, obj: Customer):
     if not self.get(obj.UzivatelID):
         return False
     DBEngine.get_session().delete(obj)
     DBEngine.get_session().commit()
     return True
Beispiel #21
0
 def get_all(self):
     alergens = DBEngine.get_session().query(Alergen).all()
     return alergens
Beispiel #22
0
 def get_all(self):
     customers = DBEngine.get_session().query(Customer).all()
     return customers
Beispiel #23
0
 def add(self, obj: Reservation):
     if self.get(obj.RezervaceID):
         return False
     DBEngine.get_session().add(obj)
     DBEngine.get_session().commit()
     return True
Beispiel #24
0
 def get(self, obj_id: int):
     return DBEngine.get_session().query(Menu).filter(
         Menu.MenuID == obj_id).first()
Beispiel #25
0
 def get_all(self):
     reservations = DBEngine.get_session().query(Reservation).all()
     return reservations
Beispiel #26
0
 def get(self, obj_id: int):
     return DBEngine.get_session().query(Meal).filter(
         Meal.JidloID == obj_id).first()
Beispiel #27
0
 def add(self, obj: Address):
     if self.get(obj.AdresaID):
         return False
     DBEngine.get_session().add(obj)
     DBEngine.get_session().commit()
     return True
Beispiel #28
0
 def add(self, obj: Meal):
     if self.get(obj.JidloID):
         return False
     DBEngine.get_session().add(obj)
     DBEngine.get_session().commit()
     return True
Beispiel #29
0
 def get_all(self):
     addresses = DBEngine.get_session().query(Address).all()
     return addresses
Beispiel #30
0
 def get_all(self):
     tables = DBEngine.get_session().query(Table).all()
     return tables