def create_anwender(self, name, email, google_user_id): user = Anwender() user.set_benutzername(name) user.set_email(email) user.set_google_id(google_user_id) user.set_id(1) with AnwenderMapper() as mapper: return mapper.insert(user)
def delete_anwender(self, user): with AnwenderMapper() as mapper: zugehörigkeiten = self.get_zugehörigkeit_by_anwender(user.get_id()) if not (zugehörigkeiten is None): for i in zugehörigkeiten: self.delete_zugehörigkeit(i) listenobjekte = self.get_listenobjekt_by_anwender(user.get_id()) if not (listenobjekte is None): for i in listenobjekte: self.delete_listenobjekt(i) mapper.delete(user)
def save_anwender(self, user): with AnwenderMapper() as mapper: mapper.update(user)
def get_all_anwender(self): with AnwenderMapper() as mapper: return mapper.find_all()
def get_anwender_by_google_user_id(self, id): with AnwenderMapper() as mapper: return mapper.find_by_google_user_id(id)
def get_anwender_by_email(self, email): with AnwenderMapper() as mapper: return mapper.find_by_email(email)
def get_anwender_by_id(self, number): with AnwenderMapper() as mapper: return mapper.find_by_key(number)
def get_anwender_by_name(self, name): with AnwenderMapper() as mapper: return mapper.find_by_name(name)