Files
core/orm/collection.py

26 lines
817 B
Python
Raw Normal View History

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
2023-10-23 17:51:13 +03:00
from services.db import 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-01-25 22:41:27 +03:00
__tablename__ = 'shout_collection'
2022-09-03 13:50:14 +03:00
id = None # type: ignore
2024-01-25 22:41:27 +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-01-25 22:41:27 +03:00
__tablename__ = 'collection'
2022-09-03 13:50:14 +03:00
2022-11-10 08:40:32 +03:00
slug = Column(String, unique=True)
2024-01-25 22:41:27 +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-01-25 22:41:27 +03:00
created_by = Column(ForeignKey('author.id'), comment='Created By')
published_at = Column(Integer, default=lambda: int(time.time()))