Refactor database interactions to use SQLAlchemy ORM; update user and token management in api_security.py and user.py; add models for Items, Tokens, and User
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
from sqlalchemy.orm import declarative_base
|
||||
from sqlalchemy import Column, String, Numeric, Integer
|
||||
|
||||
|
||||
Base = declarative_base()
|
||||
|
||||
class Tokens(Base):
|
||||
__tablename__ = "tokens"
|
||||
tokens = Column(String(255), primary_key=True)
|
||||
time = Column(String(255))
|
||||
end_date = Column(String(255))
|
||||
|
||||
class Items(Base):
|
||||
__tablename__ = "luggage"
|
||||
clothes = Column(String(50), primary_key=True)
|
||||
weight = Column(Numeric(20, 2))
|
||||
pieces = Column(Integer)
|
||||
|
||||
class User(Base):
|
||||
__tablename__ = "user"
|
||||
username = Column(String(50), primary_key=True)
|
||||
password = Column(String(255))
|
||||
role = Column(String(50))
|
||||
Reference in New Issue
Block a user