harshbhatiyaa's picture
Upload 91 files
9fe25e8 verified
Raw
History Blame Contribute Delete
1.42 kB
import uuid
from datetime import datetime
from typing import List, Optional
from pydantic import BaseModel, Field
class RosterWorkerCreate(BaseModel):
name: str = Field(..., min_length=2)
skill: str = Field(..., min_length=2)
phone_status: str = Field("IVR only", pattern="^(IVR only|Verified)$")
status: str = Field("Available", pattern="^(Available|On job)$")
commission: int = Field(0, ge=0)
class RosterWorkerResponse(BaseModel):
id: uuid.UUID
mediator_id: uuid.UUID
name: str
skill: str
phone_status: str
status: str
commission: int
created_at: datetime
class Config:
from_attributes = True
class AdminAlertResponse(BaseModel):
id: uuid.UUID
type: str # Dispute, Fraud, IVR
text: str
severity: str # red, orange, gray
status: str # active, resolved
created_at: datetime
class Config:
from_attributes = True
class UserAdminView(BaseModel):
id: uuid.UUID
name: str
phone: str
role: str
city: str
is_active: bool
created_at: datetime
class Config:
from_attributes = True
class AdminAnalytics(BaseModel):
total_workers: int
total_customers: int
total_jobs: int
active_bookings: int
gmv: int
platform_commission: int
disputes_count: int
fraud_alerts_count: int
ivr_alerts_count: int
class Config:
from_attributes = True