# Path: nflpool/data/dbsession.py
# class DbSessionFactory:
#     factory = None
# 
#     # Start a database session at app startup
#     @staticmethod
#     def global_init(db_file):
#         if DbSessionFactory.factory:
#             return
# 
#         if not db_file or not db_file.strip():
#             raise Exception("You must specify a data file.")
# 
#         conn_str = "sqlite:///" + db_file
#         print("Connecting to db with conn string: {}".format(conn_str))
# 
#         engine = sqlalchemy.create_engine(conn_str, echo=False)
# 
#         SqlAlchemyBase.metadata.create_all(engine)
#         DbSessionFactory.factory = sqlalchemy.orm.sessionmaker(bind=engine)
# 
#     @staticmethod
#     def create_session():
#         return DbSessionFactory.factory()
# 
# Path: nflpool/data/account.py
# class Account(SqlAlchemyBase):
#     __tablename__ = "Account"
# 
#     id = Column(
#         String, primary_key=True, default=lambda: str(uuid.uuid4()).replace("-", "")
#     )
# 
#     email = Column(String, index=True, unique=True, nullable=False)
#     first_name = Column(String, nullable=False)
#     last_name = Column(String, nullable=False)
#     password_hash = Column(String)
#     created = Column(DateTime, default=datetime.datetime.now)
#     email_confirmed = Column(Boolean, nullable=False, default=False)
#     is_super_user = Column(Boolean, nullable=False, default=False)
#     twitter = Column(String, nullable=True)
#     paid = Column(Integer, default=0)


from nflpool.data.dbsession import DbSessionFactory
from nflpool.data.account import Account
    )
    print(su__query)

    if not su__query[0] == self.logged_in_user_id:
        print("You must be an administrator to view this page")
        self.redirect("/home")


class AccountService:
    @staticmethod
    def get_all_accounts():
        session = DbSessionFactory.create_session()
        account_list = session.query(Account).all()

        return account_list

    @classmethod
    def update_paid(cls, user_id: str):

        session = DbSessionFactory.create_session()

        for player in session.query(Account.id).filter(Account.id == user_id):
            session.query(Account.id).filter(Account.id == user_id).update({"paid": 1})

        session.commit()
        session.close()

    @staticmethod
    def reset_paid():


# Path: nflpool/data/dbsession.py
# class DbSessionFactory:
#     factory = None
# 
#     # Start a database session at app startup
#     @staticmethod
#     def global_init(db_file):
#         if DbSessionFactory.factory:
#             return
# 
#         if not db_file or not db_file.strip():
#             raise Exception("You must specify a data file.")
# 
#         conn_str = "sqlite:///" + db_file
#         print("Connecting to db with conn string: {}".format(conn_str))
# 
#         engine = sqlalchemy.create_engine(conn_str, echo=False)
# 
#         SqlAlchemyBase.metadata.create_all(engine)
#         DbSessionFactory.factory = sqlalchemy.orm.sessionmaker(bind=engine)
# 
#     @staticmethod
#     def create_session():
#         return DbSessionFactory.factory()
# 
# Path: nflpool/data/account.py
# class Account(SqlAlchemyBase):
#     __tablename__ = "Account"
# 
#     id = Column(
#         String, primary_key=True, default=lambda: str(uuid.uuid4()).replace("-", "")
#     )
# 
#     email = Column(String, index=True, unique=True, nullable=False)
#     first_name = Column(String, nullable=False)
#     last_name = Column(String, nullable=False)
#     password_hash = Column(String)
#     created = Column(DateTime, default=datetime.datetime.now)
#     email_confirmed = Column(Boolean, nullable=False, default=False)
#     is_super_user = Column(Boolean, nullable=False, default=False)
#     twitter = Column(String, nullable=True)
#     paid = Column(Integer, default=0)


# Path: nflpool/services/admin_service.py
from nflpool.data.dbsession import DbSessionFactory
from nflpool.data.account import Account

    )
    print(su__query)

    if not su__query[0] == self.logged_in_user_id:
        print("You must be an administrator to view this page")
        self.redirect("/home")


class AccountService:
    @staticmethod
    def get_all_accounts():
        session = DbSessionFactory.create_session()
        account_list = session.query(Account).all()

        return account_list

    @classmethod
    def update_paid(cls, user_id: str):

        session = DbSessionFactory.create_session()

        for player in session.query(Account.id).filter(Account.id == user_id):
            session.query(Account.id).filter(Account.id == user_id).update({"paid": 1})

        session.commit()
        session.close()

    @staticmethod
    def reset_paid():


        session = DbSessionFactory.create_session()