поделал сайт, сделал orm-модели, requirements.txt
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import hashlib
|
||||
|
||||
from sqlalchemy import Boolean, Column, Integer, String
|
||||
from sqlalchemy.orm import relationship
|
||||
from functions.admin.models.database import Base
|
||||
|
||||
class User(Base):
|
||||
__tablename__ = "users"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
username = Column(String(50), unique=True)
|
||||
email = Column(String(255), unique=True)
|
||||
password_hash = Column(String(255))
|
||||
is_active = Column(Boolean(), default=True)
|
||||
|
||||
tokens = relationship("Token", back_populates="user")
|
||||
|
||||
def check_password(self, password: str):
|
||||
return self.password_hash == hashlib.sha384(password.encode()).hexdigest()
|
||||
Reference in New Issue
Block a user