2023-11-03 13:10:22 +03:00
|
|
|
import time
|
2023-11-22 19:38:39 +03:00
|
|
|
|
|
|
|
from sqlalchemy import Column, ForeignKey, Integer, String
|
2025-06-30 21:46:53 +03:00
|
|
|
from sqlalchemy.orm import relationship
|
2023-11-22 19:38:39 +03:00
|
|
|
|
2025-07-25 01:04:15 +03:00
|
|
|
from orm.base import BaseModel as Base
|
2022-08-11 12:09:57 +03:00
|
|
|
|
2022-09-03 13:50:14 +03:00
|
|
|
|
2022-08-11 12:09:57 +03:00
|
|
|
class ShoutCollection(Base):
|
2024-04-17 18:32:23 +03:00
|
|
|
__tablename__ = "shout_collection"
|
2022-09-03 13:50:14 +03:00
|
|
|
|
2024-04-17 18:32:23 +03:00
|
|
|
shout = Column(ForeignKey("shout.id"), primary_key=True)
|
|
|
|
collection = Column(ForeignKey("collection.id"), primary_key=True)
|
2022-08-11 12:09:57 +03:00
|
|
|
|
|
|
|
|
2022-09-03 13:50:14 +03:00
|
|
|
class Collection(Base):
|
2024-04-17 18:32:23 +03:00
|
|
|
__tablename__ = "collection"
|
2022-09-03 13:50:14 +03:00
|
|
|
|
2024-02-19 17:22:38 +03:00
|
|
|
slug = Column(String, unique=True)
|
2024-04-17 18:32:23 +03:00
|
|
|
title = Column(String, nullable=False, comment="Title")
|
|
|
|
body = Column(String, nullable=True, comment="Body")
|
|
|
|
pic = Column(String, nullable=True, comment="Picture")
|
2023-11-03 13:10:22 +03:00
|
|
|
created_at = Column(Integer, default=lambda: int(time.time()))
|
2024-04-17 18:32:23 +03:00
|
|
|
created_by = Column(ForeignKey("author.id"), comment="Created By")
|
2024-01-25 22:41:27 +03:00
|
|
|
published_at = Column(Integer, default=lambda: int(time.time()))
|
2025-06-30 21:46:53 +03:00
|
|
|
|
|
|
|
created_by_author = relationship("Author", foreign_keys=[created_by])
|