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:
Mabe
2026-09-23 19:54:20 -07:00
parent c0108fd1e1
commit cfe8a0e22d
6 changed files with 132 additions and 163 deletions
+23
View File
@@ -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))