Add user auth to table mods

This commit is contained in:
iamBadgers
2026-05-03 00:50:33 -07:00
parent ab8b3582d0
commit d94ea04c1b
5 changed files with 54 additions and 14 deletions

View File

@@ -4,9 +4,11 @@ from main import db
from werkzeug.security import generate_password_hash, check_password_hash
from flask_login import UserMixin
def create_new_session(user: User) -> Session:
return
class User(UserMixin, db.Model):
__tablename__ = "users"
@@ -24,7 +26,13 @@ class User(UserMixin, db.Model):
return check_password_hash(self.password_hash, password)
def to_dict(self):
return {"id": self.id, "username": self.user_name, "authenticated": self.is_authenticated}
return {
"id": self.id,
"username": self.user_name,
"authenticated": self.is_authenticated,
"is_admin": self.is_admin
}
class Session(db.Model):