Merge branch 'refactor/backend-architecture' into development
This commit is contained in:
23
api/app/features/payment/models.py
Normal file
23
api/app/features/payment/models.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from sqlalchemy import Column, DateTime, ForeignKey, Integer, String
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from app.core.db import Base, utc_now
|
||||
|
||||
|
||||
class Order(Base):
|
||||
__tablename__ = "orders"
|
||||
|
||||
id = Column(String, primary_key=True)
|
||||
user_id = Column(String, ForeignKey("users.id"), nullable=False, index=True)
|
||||
plan_id = Column(String, nullable=False)
|
||||
plan_name = Column(String, nullable=False)
|
||||
amount = Column(Integer, nullable=False)
|
||||
currency = Column(String, default="CNY")
|
||||
payment_method = Column(String, nullable=False)
|
||||
status = Column(String, default="pending")
|
||||
trade_no = Column(String, nullable=True, index=True)
|
||||
paid_at = Column(DateTime(timezone=True), nullable=True)
|
||||
created_at = Column(DateTime(timezone=True), default=utc_now)
|
||||
expired_at = Column(DateTime(timezone=True), nullable=True)
|
||||
|
||||
user = relationship("User", back_populates="orders")
|
||||
Reference in New Issue
Block a user