# Path: onefl/models/base.py
# def init(engine):
# def get_session():
# 
# Path: onefl/models/crud_mixin.py
# class CRUDMixin():
#     """ Helper class sqlalchemy entities """
#     __table_args__ = {'extend_existing': True}
# 
#     # id = db.Column(db.Integer, primary_key=True)
# 
#     @classmethod
#     def get_by_id(cls, id):
#         if any(
#             (isinstance(id, str) and id.isdigit(),
#              isinstance(id, (int, float))),):
#             session = get_session()
#             # return cls.query.get(int(id))
#             # return session.query(cls).filter_by(id=int(id)).one()
#             return session.query(cls).get(int(id))
#         return None
# 
#     @classmethod
#     def create(cls, **kwargs):
#         """ Helper for add() + commit() """
#         instance = cls(**kwargs)
#         return instance.save()
# 
#     def update(self, commit=True, **kwargs):
#         """ update object instance """
#         for attr, value in kwargs.items():
#             setattr(self, attr, value)
#         return self.save() if commit else self
# 
#     def save(self, commit=True):
#         """ save object instance """
#         session = get_session()
#         session.add(self)
# 
#         if commit:
#             session.commit()
#         return self
# 
#     def delete(self, commit=True):
#         """ delete object instance """
#         session = get_session()
#         session.delete(self)
#         return commit and session.commit()


import sqlalchemy as db
from onefl.models.base import DeclarativeBase
from onefl.models.crud_mixin import CRUDMixin
"""
ORM for "partner" table

@authors:
    Andrei Sura <sura.andrei@gmail.com>
"""



"""
+---------------------+------------------+------+-----+---------+
| Field               | Type             | Null | Key | Default |
+---------------------+------------------+------+-----+---------+
| partner_code        | varchar(3)       | NO   | UNI | NULL    |
| partner_description | varchar(255)     | NO   |     | NULL    |
| partner_added_at    | datetime         | NO   |     | NULL    |
+---------------------+------------------+------+-----+---------+
"""

__all__ = ['PartnerEntity']



# Path: onefl/models/base.py
# def init(engine):
# def get_session():
# 
# Path: onefl/models/crud_mixin.py
# class CRUDMixin():
#     """ Helper class sqlalchemy entities """
#     __table_args__ = {'extend_existing': True}
# 
#     # id = db.Column(db.Integer, primary_key=True)
# 
#     @classmethod
#     def get_by_id(cls, id):
#         if any(
#             (isinstance(id, str) and id.isdigit(),
#              isinstance(id, (int, float))),):
#             session = get_session()
#             # return cls.query.get(int(id))
#             # return session.query(cls).filter_by(id=int(id)).one()
#             return session.query(cls).get(int(id))
#         return None
# 
#     @classmethod
#     def create(cls, **kwargs):
#         """ Helper for add() + commit() """
#         instance = cls(**kwargs)
#         return instance.save()
# 
#     def update(self, commit=True, **kwargs):
#         """ update object instance """
#         for attr, value in kwargs.items():
#             setattr(self, attr, value)
#         return self.save() if commit else self
# 
#     def save(self, commit=True):
#         """ save object instance """
#         session = get_session()
#         session.add(self)
# 
#         if commit:
#             session.commit()
#         return self
# 
#     def delete(self, commit=True):
#         """ delete object instance """
#         session = get_session()
#         session.delete(self)
#         return commit and session.commit()


# Path: onefl/models/partner_entity.py
import sqlalchemy as db
from onefl.models.base import DeclarativeBase
from onefl.models.crud_mixin import CRUDMixin

"""
ORM for "partner" table

@authors:
    Andrei Sura <sura.andrei@gmail.com>
"""



"""
+---------------------+------------------+------+-----+---------+
| Field               | Type             | Null | Key | Default |
+---------------------+------------------+------+-----+---------+
| partner_code        | varchar(3)       | NO   | UNI | NULL    |
| partner_description | varchar(255)     | NO   |     | NULL    |
| partner_added_at    | datetime         | NO   |     | NULL    |
+---------------------+------------------+------+-----+---------+
"""

__all__ = ['PartnerEntity']



class PartnerEntity(CRUDMixin, DeclarativeBase):