core/orm/collection.py
Ilya Y b63b6e7ee7
timezones fixed once again (#107)
Co-authored-by: Igor Lobanov <igor.lobanov@onetwotrip.com>
2023-11-14 14:56:41 +03:00

24 lines
851 B
Python

from sqlalchemy import Column, DateTime, ForeignKey, String, func
from base.orm import Base
class ShoutCollection(Base):
__tablename__ = "shout_collection"
id = None
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(timezone=True), server_default=func.now(), comment="Created At")
createdBy = Column(ForeignKey("user.id"), comment="Created By")
publishedAt = Column(DateTime(timezone=True), server_default=func.now(), comment="Published At")