2022-09-02 10:23:33 +00:00
|
|
|
from datetime import datetime
|
2022-09-17 18:12:14 +00:00
|
|
|
|
2022-09-02 10:23:33 +00:00
|
|
|
from sqlalchemy import Boolean, Column, String, ForeignKey, DateTime
|
2022-11-19 12:02:45 +00:00
|
|
|
from sqlalchemy.orm import relationship
|
2022-09-02 10:23:33 +00:00
|
|
|
from base.orm import Base
|
2022-11-19 12:02:45 +00:00
|
|
|
from orm.user import User
|
2022-09-02 10:23:33 +00:00
|
|
|
|
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)
|
2022-11-29 12:36:46 +00:00
|
|
|
author_id = Column(ForeignKey("user.id"), primary_key=True)
|
2022-09-03 10:50:14 +00:00
|
|
|
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
|
|
|
title = Column(String, nullable=True, comment="Title")
|
|
|
|
body = Column(String, nullable=True, comment="Body")
|
|
|
|
pic = Column(String, nullable=True, comment="Picture")
|
2022-11-19 12:02:45 +00:00
|
|
|
authors = relationship(lambda: User, secondary=CollabAuthor.__tablename__)
|
2022-09-03 10:50:14 +00:00
|
|
|
createdAt = Column(DateTime, default=datetime.now, comment="Created At")
|
|
|
|
createdBy = Column(ForeignKey("user.id"), comment="Created By")
|