From 4456a9592d75df1fb473253f96c851899271fe2d Mon Sep 17 00:00:00 2001 From: David Whittaker Date: Fri, 29 Sep 2023 15:53:05 -0700 Subject: [PATCH] Adding owner and pinned attributes to timeline events --- .../revisions/tenant/versions/2023-09-15_3538650dc471.py | 4 ++++ src/dispatch/event/models.py | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/dispatch/database/revisions/tenant/versions/2023-09-15_3538650dc471.py b/src/dispatch/database/revisions/tenant/versions/2023-09-15_3538650dc471.py index 13c9a40a03d1..be36711650e8 100644 --- a/src/dispatch/database/revisions/tenant/versions/2023-09-15_3538650dc471.py +++ b/src/dispatch/database/revisions/tenant/versions/2023-09-15_3538650dc471.py @@ -18,10 +18,14 @@ def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column("event", sa.Column("type", sa.String(), nullable=True)) + op.add_column('event', sa.Column('owner', sa.String(), nullable=True)) + op.add_column('event', sa.Column('pinned', sa.Boolean(), nullable=True)) # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_column("event", "type") + op.drop_column('event', 'pinned') + op.drop_column('event', 'owner') # ### end Alembic commands ### diff --git a/src/dispatch/event/models.py b/src/dispatch/event/models.py index f8d3c1b38c5a..fc647206ed86 100644 --- a/src/dispatch/event/models.py +++ b/src/dispatch/event/models.py @@ -3,7 +3,7 @@ from typing import Optional -from sqlalchemy import Column, DateTime, ForeignKey, Integer, String +from sqlalchemy import Column, DateTime, ForeignKey, Integer, String, Boolean from sqlalchemy.dialects.postgresql import UUID as SQLAlchemyUUID from sqlalchemy_utils import TSVectorType, JSONType @@ -23,6 +23,8 @@ class Event(Base, TimeStampMixin): description = Column(String, nullable=False) details = Column(JSONType, nullable=True) type = Column(String, default=EventType.other, nullable=True) + owner = Column(String, nullable=True) + pinned = Column(Boolean, default=False) # relationships individual_id = Column(Integer, ForeignKey("individual_contact.id", ondelete="CASCADE")) @@ -48,6 +50,8 @@ class EventBase(DispatchBase): description: str details: Optional[dict] type: Optional[str] + owner: Optional[str] + pinned: Optional[bool] class EventCreate(EventBase):