Exemple #1
0
    def update(self, entity: BaseEntity, update_id: int):
        upd_entity = self.model.query.get(update_id)

        entity.pre_update()
        db.session.update(entity)
        self.db.session.commit()

        return upd_entity
Exemple #2
0
    def create(self, entity: BaseEntity):
        entity.pre_update()
        self.db.session.add(entity)
        self.db.session.commit()

        return entity