core/orm/collection.py
Igor Lobanov c2cc428abe lint
2023-10-26 22:38:31 +02:00

24 lines
850 B
Python

from base.orm import Base
from datetime import datetime
from sqlalchemy import Column, DateTime, ForeignKey, String
class ShoutCollection(Base):
__tablename__ = "shout_collection"
id = None # type: ignore
shout = Column(ForeignKey("shout.id"), primary_key=True)
collection = Column(ForeignKey("collection.id"), primary_key=True)
class Collection(Base):
__tablename__ = "collection"
slug = Column(String, unique=True)
title = Column(String, nullable=False, comment="Title")
body = Column(String, nullable=True, comment="Body")
pic = Column(String, nullable=True, comment="Picture")
createdAt = Column(DateTime, default=datetime.now, comment="Created At")
createdBy = Column(ForeignKey("user.id"), comment="Created By")
publishedAt = Column(DateTime, default=datetime.now, comment="Published At")