init commit
This commit is contained in:
39
services/user_service/models.py
Normal file
39
services/user_service/models.py
Normal file
@@ -0,0 +1,39 @@
|
||||
from sqlalchemy import Column, String, Integer, Date, Text, Boolean
|
||||
from sqlalchemy.dialects.postgresql import UUID
|
||||
from shared.database import BaseModel
|
||||
import uuid
|
||||
|
||||
|
||||
class User(BaseModel):
|
||||
__tablename__ = "users"
|
||||
|
||||
uuid = Column(UUID(as_uuid=True), default=uuid.uuid4, unique=True, index=True)
|
||||
email = Column(String, unique=True, index=True, nullable=False)
|
||||
phone = Column(String, unique=True, index=True)
|
||||
password_hash = Column(String, nullable=False)
|
||||
|
||||
# Profile information
|
||||
first_name = Column(String(50), nullable=False)
|
||||
last_name = Column(String(50), nullable=False)
|
||||
date_of_birth = Column(Date)
|
||||
avatar_url = Column(String)
|
||||
bio = Column(Text)
|
||||
|
||||
# Emergency contacts
|
||||
emergency_contact_1_name = Column(String(100))
|
||||
emergency_contact_1_phone = Column(String(20))
|
||||
emergency_contact_2_name = Column(String(100))
|
||||
emergency_contact_2_phone = Column(String(20))
|
||||
|
||||
# Settings
|
||||
location_sharing_enabled = Column(Boolean, default=True)
|
||||
emergency_notifications_enabled = Column(Boolean, default=True)
|
||||
push_notifications_enabled = Column(Boolean, default=True)
|
||||
|
||||
# Security
|
||||
email_verified = Column(Boolean, default=False)
|
||||
phone_verified = Column(Boolean, default=False)
|
||||
is_blocked = Column(Boolean, default=False)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<User {self.email}>"
|
||||
Reference in New Issue
Block a user