# Path: database.py
# def get_session():
# def teardown_session(exception):


from database import TableBase, Column, Integer, String, session, Text, MEDIUMTEXT
from flask_login import UserMixin
import hashlib
import random
import string
import os
    description = Column(Text())
    education = Column(Text())
    major = Column(Text())

    def __init__(self, email, password, username):
        self.email = email
        self.set_password(password)
        self.username = username

    def set_password(self, password):
        """hash and save the password"""
        self.salt = random_string(10)
        s = hashlib.sha256()
        s.update(password.encode('utf-8'))
        s.update(self.salt.encode('utf-8'))
        self.passwordhash = s.hexdigest()

    def check_password(self, password):
        """hash and check the password"""
        s = hashlib.sha256()
        s.update(password.encode('utf-8'))
        s.update(self.salt.encode('utf-8'))
        return self.passwordhash == s.hexdigest()

    @classmethod
    def get_user_by_email(cls, email):
        return session.query(cls).filter_by(email=email).first()

    @classmethod
    def get_user_by_id(cls, id):

# Path: database.py
# def get_session():
# def teardown_session(exception):


# Path: models/user.py
from database import TableBase, Column, Integer, String, session, Text, MEDIUMTEXT
from flask_login import UserMixin
import hashlib
import random
import string
import os

    description = Column(Text())
    education = Column(Text())
    major = Column(Text())

    def __init__(self, email, password, username):
        self.email = email
        self.set_password(password)
        self.username = username

    def set_password(self, password):
        """hash and save the password"""
        self.salt = random_string(10)
        s = hashlib.sha256()
        s.update(password.encode('utf-8'))
        s.update(self.salt.encode('utf-8'))
        self.passwordhash = s.hexdigest()

    def check_password(self, password):
        """hash and check the password"""
        s = hashlib.sha256()
        s.update(password.encode('utf-8'))
        s.update(self.salt.encode('utf-8'))
        return self.passwordhash == s.hexdigest()

    @classmethod
    def get_user_by_email(cls, email):
        return session.query(cls).filter_by(email=email).first()

    @classmethod
    def get_user_by_id(cls, id):

        return session.query(cls).get(id)