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
def __init__(self, user: User, name, description, price): BaseEntity.__init__(self) self.owner_id = user.id self.name = name self.description = description self.price = price
def __init__(self, user: User, name, description, charge): BaseEntity.__init__(self) self.owner_id = user.id self.name = name self.description = description self.charge = charge
def __init__(self, user: User, acc_name, bank_name, sort_code, acc_number): BaseEntity.__init__(self) self.owner_id = user.id self.acc_name = acc_name self.bank_name = bank_name self.sort_code = sort_code self.acc_number = acc_number
def get_all(self) : entities = [] entity1 = BaseEntity() #"Test User1", "Passwor1") entity2 = BaseEntity() #"Test User2", "Passwor1") entities.append(entity1) entities.append(entity2) return entities
def __init__(self, user:User, name, phone, address_1, address_2, city, post_code): BaseEntity.__init__(self) self.owner_id = user.id self.name = name self.phone = phone self.address_1 = address_1 self.address_2 = address_2 self.city = city self.post_code = post_code # name phone address_1 address_2 city post_code
def __init__(self, user:User, name, contact_person, email, phone, address_ln_1, address_ln_2, city, postal_code): BaseEntity.__init__(self) self.owner_id = user.id self.trading_name=trading_name self.contact_person=contact_person self.email=email self.phone=phone self.address_ln_1=address_ln_1 self.address_ln_2=address_ln_2 self.city=city self.postal_code=postal_code
def __init__(self): BaseEntity.__init__(self)
def __init__(self, user): BaseEntity.__init__(self) self.user = user
def create(self, entity: BaseEntity): entity.pre_update() self.db.session.add(entity) self.db.session.commit() return entity
def __init__(self, username, email, password): BaseEntity.__init__(self) self.username = username self.email = email self.password_hash = bcrypt.generate_password_hash(password)
def find(self, id): return BaseEntity() #"Test User1", "Passwor1")
def update(self, entity:BaseEntity, id): if isinstance(entity, BaseEntity) : return BaseEntity() #"Test User1", "Passwor1")