Initial commit for deployment
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
"""
|
||||
User model for the application.
|
||||
"""
|
||||
|
||||
from datetime import datetime
|
||||
from app.database.db import db
|
||||
|
||||
class User(db.Model):
|
||||
"""User model representing application users."""
|
||||
|
||||
__tablename__ = 'users'
|
||||
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
username = db.Column(db.String(64), unique=True, nullable=False, index=True)
|
||||
email = db.Column(db.String(120), unique=True, nullable=False, index=True)
|
||||
password_hash = db.Column(db.String(128), nullable=False)
|
||||
created_at = db.Column(db.DateTime, default=datetime.utcnow)
|
||||
updated_at = db.Column(db.DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
||||
|
||||
# Relationships
|
||||
chats = db.relationship('Chat', backref='user', lazy='dynamic')
|
||||
|
||||
def __repr__(self):
|
||||
return f'<User {self.username}>'
|
||||
Reference in New Issue
Block a user