Add Request.internal_comments
Using a one to one relationship to avoid the migration hell that we're temporarily stuck in.
This commit is contained in:
@@ -16,3 +16,4 @@ from .environment import Environment
|
||||
from .attachment import Attachment
|
||||
from .request_revision import RequestRevision
|
||||
from .request_review import RequestReview
|
||||
from .request_internal_comment import RequestInternalComment
|
||||
|
@@ -46,6 +46,8 @@ class Request(Base):
|
||||
"RequestRevision", back_populates="request", order_by="RequestRevision.sequence"
|
||||
)
|
||||
|
||||
internal_comments = relationship("RequestInternalComment", uselist=False)
|
||||
|
||||
@property
|
||||
def latest_revision(self):
|
||||
if self.revisions:
|
||||
|
16
atst/models/request_internal_comment.py
Normal file
16
atst/models/request_internal_comment.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from sqlalchemy import Column, BigInteger, String, ForeignKey
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from atst.models import Base
|
||||
|
||||
|
||||
class RequestInternalComment(Base):
|
||||
__tablename__ = "request_internal_comments"
|
||||
|
||||
id = Column(BigInteger, primary_key=True)
|
||||
text = Column(String())
|
||||
|
||||
user_id = Column(ForeignKey("users.id"), nullable=False)
|
||||
user = relationship("User")
|
||||
|
||||
request_id = Column(ForeignKey("requests.id", ondelete="CASCADE"))
|
Reference in New Issue
Block a user