core/orm/collection.py

24 lines
808 B
Python
Raw Normal View History

2022-08-11 09:09:57 +00:00
from datetime import datetime
2022-09-03 10:50:14 +00:00
from sqlalchemy import Column, String, ForeignKey, DateTime
2022-08-11 09:09:57 +00:00
from base.orm import Base
2022-09-03 10:50:14 +00:00
2022-08-11 09:09:57 +00:00
class ShoutCollection(Base):
2022-09-03 10:50:14 +00:00
__tablename__ = "shout_collection"
id = None # type: ignore
shout = Column(ForeignKey("shout.slug"), primary_key=True)
collection = Column(ForeignKey("collection.slug"), primary_key=True)
2022-08-11 09:09:57 +00:00
2022-09-03 10:50:14 +00:00
class Collection(Base):
__tablename__ = "collection"
id = None # type: ignore
slug = Column(String, primary_key=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")