def update(self, article: Article, data: dict): if 'name' in data: article.name = data['name'] if 'price' in data: article.price = data['price'] try: self._database_session.merge(article) self._database_session.flush() except IntegrityError: raise Error("Error data may be malformed") return article
def create(self, data: dict): try: art = Article(firstname=data.get('firstname'),email=data.get('price'), type=data.get('quantity')) self._database_session.add(art) self._database_session.flush() except IntegrityError: raise Error("Article already exists") return art
def create(self, data: dict): try: article = Article(name=data.get('name'), price=data.get('price')) self._database_session.add(article) self._database_session.flush() except IntegrityError: raise Error("Member already exists") return article
def create(self, data: dict): try: article = Article(name=data.get('name'), type=data.get('type'), description=data.get('description'), provenance=data.get('provenance')) self._database_session.add(article) self._database_session.flush() except IntegrityError: raise Error("Article already exists") return article
def create(self, data: dict): try: article = Article(name=data.get('name'), size=data.get('size'), theme=data.get('theme'), color=data.get('color')) self._database_session.add(article) self._database_session.flush() except IntegrityError: raise Error("Article already exists") return article