core/orm/collab.py

26 lines
789 B
Python
Raw Normal View History

2022-09-02 10:23:33 +00:00
from datetime import datetime
2022-09-02 10:23:33 +00:00
from sqlalchemy import Boolean, Column, String, ForeignKey, DateTime
2022-09-02 10:23:33 +00:00
from base.orm import Base
2022-09-03 10:50:14 +00:00
2022-09-02 10:23:33 +00:00
class CollabAuthor(Base):
2022-09-03 10:50:14 +00:00
__tablename__ = "collab_author"
2022-09-02 10:23:33 +00:00
2022-09-03 10:50:14 +00:00
id = None # type: ignore
collab = Column(ForeignKey("collab.id"), primary_key=True)
author = Column(ForeignKey("user.slug"), primary_key=True)
accepted = Column(Boolean, default=False)
2022-09-02 10:23:33 +00:00
2022-09-03 10:50:14 +00:00
class Collab(Base):
__tablename__ = "collab"
2022-09-02 10:23:33 +00:00
2022-09-03 10:50:14 +00:00
authors = Column()
title = Column(String, nullable=True, 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")