mirror of
https://github.com/hoshikawa2/rfp_response_automation.git
synced 2026-07-10 12:04:20 +00:00
first commit
This commit is contained in:
27
files/modules/users/model.py
Normal file
27
files/modules/users/model.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from datetime import datetime
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
|
||||
db = SQLAlchemy()
|
||||
|
||||
|
||||
class User(db.Model):
|
||||
__tablename__ = "users"
|
||||
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
|
||||
name = db.Column(db.String(120), nullable=False)
|
||||
email = db.Column(db.String(160), unique=True, nullable=False, index=True)
|
||||
|
||||
role = db.Column(db.String(50), default="app") # app | admin
|
||||
active = db.Column(db.Boolean, default=True)
|
||||
|
||||
password_hash = db.Column(db.String(255))
|
||||
must_change_password = db.Column(db.Boolean, default=True)
|
||||
|
||||
reset_token = db.Column(db.String(255))
|
||||
reset_expire = db.Column(db.DateTime)
|
||||
|
||||
created_at = db.Column(db.DateTime, default=datetime.utcnow)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<User {self.email}>"
|
||||
Reference in New Issue
Block a user