some orm fixes

This commit is contained in:
2022-11-19 15:02:45 +03:00
parent 47b285f8ac
commit 56a1467d3c
4 changed files with 18 additions and 14 deletions

View File

@@ -1,8 +1,9 @@
from datetime import datetime
from sqlalchemy import Boolean, Column, String, ForeignKey, DateTime
from sqlalchemy.orm import relationship
from base.orm import Base
from orm.user import User
class CollabAuthor(Base):
@@ -21,5 +22,6 @@ class Collab(Base):
title = Column(String, nullable=True, comment="Title")
body = Column(String, nullable=True, comment="Body")
pic = Column(String, nullable=True, comment="Picture")
authors = relationship(lambda: User, secondary=CollabAuthor.__tablename__)
createdAt = Column(DateTime, default=datetime.now, comment="Created At")
createdBy = Column(ForeignKey("user.id"), comment="Created By")