From 36fcb33d7ee7ed7b7787268a2b5247182231a1ef Mon Sep 17 00:00:00 2001 From: Leopoldadmin Date: Sat, 4 Jul 2026 00:15:23 +0000 Subject: [PATCH] feat(core): add address fields to Contact model --- app/models/contact.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/app/models/contact.py b/app/models/contact.py index 400a82c..4b7d9c9 100644 --- a/app/models/contact.py +++ b/app/models/contact.py @@ -42,16 +42,18 @@ class Contact(Base, TenantMixin): department: Mapped[str | None] = mapped_column(String(100), nullable=True) linkedin_url: Mapped[str | None] = mapped_column(String(500), nullable=True) notes: Mapped[str | None] = mapped_column(Text, nullable=True) + # Address fields (private address, may differ from company) + address_street: Mapped[str | None] = mapped_column(String(255), nullable=True) + address_city: Mapped[str | None] = mapped_column(String(100), nullable=True) + address_zip: Mapped[str | None] = mapped_column(String(20), nullable=True) + address_country: Mapped[str | None] = mapped_column(String(2), nullable=True) + address_state: Mapped[str | None] = mapped_column(String(100), nullable=True) deleted_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True) created_by: Mapped[uuid.UUID | None] = mapped_column( - PGUUID(as_uuid=True), - ForeignKey("users.id", ondelete="SET NULL"), - nullable=True, + PGUUID(as_uuid=True), ForeignKey("users.id", ondelete="SET NULL"), nullable=True ) updated_by: Mapped[uuid.UUID | None] = mapped_column( - PGUUID(as_uuid=True), - ForeignKey("users.id", ondelete="SET NULL"), - nullable=True, + PGUUID(as_uuid=True), ForeignKey("users.id", ondelete="SET NULL"), nullable=True ) @@ -69,14 +71,10 @@ class CompanyContact(Base, TenantMixin): PGUUID(as_uuid=True), primary_key=True, default=uuid.uuid4 ) company_id: Mapped[uuid.UUID] = mapped_column( - PGUUID(as_uuid=True), - ForeignKey("companies.id", ondelete="CASCADE"), - nullable=False, + PGUUID(as_uuid=True), ForeignKey("companies.id", ondelete="CASCADE"), nullable=False ) contact_id: Mapped[uuid.UUID] = mapped_column( - PGUUID(as_uuid=True), - ForeignKey("contacts.id", ondelete="CASCADE"), - nullable=False, + PGUUID(as_uuid=True), ForeignKey("contacts.id", ondelete="CASCADE"), nullable=False ) role_at_company: Mapped[str | None] = mapped_column(String(100), nullable=True) is_primary: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)