This commit is contained in:
21
services/user_service/emergency_contact_model.py
Normal file
21
services/user_service/emergency_contact_model.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import uuid
|
||||
|
||||
from sqlalchemy import Column, ForeignKey, Integer, String, Text
|
||||
from sqlalchemy.dialects.postgresql import UUID
|
||||
from sqlalchemy.orm import relationship as orm_relationship
|
||||
|
||||
from shared.database import BaseModel
|
||||
|
||||
|
||||
class EmergencyContact(BaseModel):
|
||||
__tablename__ = "emergency_contacts"
|
||||
|
||||
uuid = Column(UUID(as_uuid=True), default=uuid.uuid4, unique=True, index=True)
|
||||
user_id = Column(Integer, ForeignKey("users.id"), index=True, nullable=False)
|
||||
name = Column(String(100), nullable=False)
|
||||
phone_number = Column(String(20), nullable=False)
|
||||
relation_type = Column(String(50)) # Переименовано из relationship в relation_type
|
||||
notes = Column(Text)
|
||||
|
||||
# Отношение к пользователю
|
||||
user = orm_relationship("User", back_populates="emergency_contacts")
|
||||
Reference in New Issue
Block a user