2025-01-20 06:50:07 +01:00
|
|
|
from sqlalchemy import ForeignKey, Column, Integer, TIMESTAMP, Float
|
|
|
|
from sqlalchemy.orm import relationship
|
2024-12-02 08:45:08 +01:00
|
|
|
|
2025-01-20 06:50:07 +01:00
|
|
|
from .base_model import Base
|
2024-12-02 08:45:08 +01:00
|
|
|
|
|
|
|
|
2025-01-20 06:50:07 +01:00
|
|
|
class Cart(Base):
|
|
|
|
__tablename__ = 'cart'
|
2024-12-02 08:45:08 +01:00
|
|
|
|
2025-01-20 06:50:07 +01:00
|
|
|
id = Column(Integer, primary_key=True)
|
|
|
|
user_id = Column(Integer, ForeignKey('user.id'), nullable=False)
|
|
|
|
total = Column(Float, nullable=False)
|
|
|
|
last_updated = Column(TIMESTAMP)
|
2024-12-02 08:45:08 +01:00
|
|
|
|
2025-01-20 06:50:07 +01:00
|
|
|
user = relationship('User', back_populates='carts')
|
|
|
|
entries = relationship('CartEntry', back_populates='cart')
|