54 lines
1.3 KiB
Python
54 lines
1.3 KiB
Python
"""Schemas for map sharing."""
|
|
from pydantic import BaseModel
|
|
from uuid import UUID
|
|
from datetime import datetime
|
|
from typing import Optional
|
|
from app.models.map_share import SharePermission
|
|
|
|
|
|
class MapShareCreate(BaseModel):
|
|
"""Schema for creating a map share with a specific user."""
|
|
user_identifier: str # Can be username, email, or UUID
|
|
permission: SharePermission = SharePermission.READ
|
|
|
|
|
|
class MapShareUpdate(BaseModel):
|
|
"""Schema for updating map share permissions."""
|
|
permission: SharePermission
|
|
|
|
|
|
class MapShareResponse(BaseModel):
|
|
"""Schema for map share response."""
|
|
id: UUID
|
|
map_id: UUID
|
|
user_id: UUID
|
|
permission: SharePermission
|
|
shared_by: Optional[UUID]
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class MapShareLinkCreate(BaseModel):
|
|
"""Schema for creating a public share link."""
|
|
permission: SharePermission = SharePermission.READ
|
|
expires_at: Optional[datetime] = None
|
|
|
|
|
|
class MapShareLinkResponse(BaseModel):
|
|
"""Schema for share link response."""
|
|
id: UUID
|
|
map_id: UUID
|
|
token: str
|
|
permission: SharePermission
|
|
is_active: bool
|
|
created_by: Optional[UUID]
|
|
expires_at: Optional[datetime]
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True
|