- Updated test functions in various test files to enhance code clarity by formatting long lines and improving indentation. - Adjusted assertions to use multi-line formatting for better readability. - Added new test cases for theme settings API to ensure proper functionality. - Ensured consistent use of line breaks and spacing across test files for uniformity.
24 lines
782 B
Python
24 lines
782 B
Python
from sqlalchemy import Column, Integer, String, ForeignKey
|
|
from sqlalchemy.orm import relationship
|
|
|
|
from config.database import Base
|
|
from services.security import get_password_hash, verify_password
|
|
|
|
|
|
class User(Base):
|
|
__tablename__ = "users"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
username = Column(String, unique=True, index=True)
|
|
email = Column(String, unique=True, index=True)
|
|
hashed_password = Column(String)
|
|
role_id = Column(Integer, ForeignKey("roles.id"))
|
|
|
|
role = relationship("Role", back_populates="users")
|
|
|
|
def set_password(self, password: str):
|
|
self.hashed_password = get_password_hash(password)
|
|
|
|
def check_password(self, password: str) -> bool:
|
|
return verify_password(password, str(self.hashed_password))
|