04/27 Fixed some issues

This commit is contained in:
2026-04-27 13:36:30 -04:00
parent ff0650e1d9
commit 821cd929f1
7 changed files with 75 additions and 10 deletions
+5 -5
View File
@@ -5,7 +5,8 @@ from app.utils.time_utils import now_eastern
@login_manager.user_loader
def load_user(user_id):
return User.query.get(int(user_id))
from app import db
return db.session.get(User, int(user_id))
class User(UserMixin, db.Model):
__tablename__ = 'users'
@@ -16,10 +17,9 @@ class User(UserMixin, db.Model):
email = db.Column(db.String(255), unique=True, nullable=False, index=True)
password_hash = db.Column(db.String(255), nullable=False)
role = db.Column(
# 'supervisor' retained temporarily so the Enum is valid before the
# migration UPDATE runs. The migration removes it after all rows are
# updated to 'director'.
db.Enum('admin', 'supervisor', 'director', 'inspector', 'project_manager', 'customer'),
# Phase 11 migration complete — 'supervisor' removed from both the DB
# ENUM and this Python-side declaration. Director is the canonical role.
db.Enum('admin', 'director', 'inspector', 'project_manager', 'customer'),
nullable=False
)
created_at = db.Column(db.DateTime, default=now_eastern)