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 __init__(self, user: User, name, description, price):
        BaseEntity.__init__(self)

        self.owner_id = user.id

        self.name = name
        self.description = description
        self.price = price
Exemple #3
0
    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
Exemple #4
0
    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
Exemple #5
0
    def get_all(self) :
        entities = []
        entity1 = BaseEntity() #"Test User1", "Passwor1")
        entity2 = BaseEntity() #"Test User2", "Passwor1")

        entities.append(entity1)
        entities.append(entity2)

        return entities
         
Exemple #6
0
    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
Exemple #7
0
    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

        
Exemple #8
0
    def __init__(self):
        BaseEntity.__init__(self)

         
Exemple #9
0
 def __init__(self, user):
     BaseEntity.__init__(self)
     self.user = user
Exemple #10
0
    def create(self, entity: BaseEntity):
        entity.pre_update()
        self.db.session.add(entity)
        self.db.session.commit()

        return entity
Exemple #11
0
 def __init__(self, username, email, password):
     BaseEntity.__init__(self)
     self.username = username
     self.email = email
     self.password_hash = bcrypt.generate_password_hash(password)
Exemple #12
0
 def find(self, id):        
     return BaseEntity() #"Test User1", "Passwor1")
Exemple #13
0
 def update(self, entity:BaseEntity, id):        
     if isinstance(entity, BaseEntity) :
         return BaseEntity() #"Test User1", "Passwor1")