remove contact table

This commit is contained in:
2025-10-01 22:36:32 +03:00
parent 58185a11a9
commit 2c7522018f
2 changed files with 43 additions and 13 deletions

View File

@@ -17,11 +17,10 @@ class User(Base):
fullname: Mapped[str] = mapped_column()
role: Mapped[str] = mapped_column(default=UserRole.USER.value)
phone: Mapped[str] = mapped_column(nullable=True)
email: Mapped[str] = mapped_column(nullable=True)
events = relationship("UserEvent", back_populates="user_rel")
certificates = relationship("Certificate", back_populates="user_rel")
addresses = relationship("Address", back_populates="user_rel")
contacts = relationship("Contact", back_populates="user_rel")
class Event(Base):
@@ -87,14 +86,4 @@ class Address(Base):
extended_address: Mapped[str] = mapped_column()
postal_code: Mapped[str] = mapped_column()
user_rel = relationship("User", back_populates="addresses")
class Contact(Base):
__tablename__ = "contact"
id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True)
user_id: Mapped[int] = mapped_column(ForeignKey("user.id"))
type: Mapped[str] = mapped_column()
value: Mapped[str] = mapped_column()
user_rel = relationship("User", back_populates="contacts")
user_rel = relationship("User", back_populates="addresses")