Add backend/app/models/view.py
This commit is contained in:
@@ -0,0 +1,19 @@
|
|||||||
|
"""View model."""
|
||||||
|
from sqlalchemy import Column, Integer, String, ForeignKey, DateTime, Text
|
||||||
|
from sqlalchemy.orm import relationship
|
||||||
|
from datetime import datetime
|
||||||
|
from app.database import Base
|
||||||
|
|
||||||
|
class View(Base):
|
||||||
|
"""View model."""
|
||||||
|
__tablename__ = "views"
|
||||||
|
|
||||||
|
id = Column(Integer, primary_key=True, index=True)
|
||||||
|
name = Column(String(255), nullable=False)
|
||||||
|
view_type = Column(String(50), default="grid") # grid, gallery, form
|
||||||
|
table_id = Column(Integer, ForeignKey("tables.id"), nullable=False)
|
||||||
|
config = Column(Text) # JSON config for view settings
|
||||||
|
created_at = Column(DateTime, default=datetime.utcnow)
|
||||||
|
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
||||||
|
|
||||||
|
table = relationship("Table", back_populates="views")
|
||||||
Reference in New Issue
Block a user