feat: add Layer 3 - API Gateway main app, WhatsApp routes, Frontend pages
API Gateway: - main.py with FastAPI app, CORS, health endpoints - WhatsApp routes: accounts CRUD, conversations, messages, internal events - WhatsApp schemas for request/response validation Frontend: - Login page with register option for first admin - MainLayout with sidebar navigation and user dropdown - Dashboard with statistics cards (accounts, conversations) - WhatsApp Accounts page with QR modal for connection - Inbox page with conversation list and real-time chat Full feature set for Fase 1 Foundation complete. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
76
services/api-gateway/app/schemas/whatsapp.py
Normal file
76
services/api-gateway/app/schemas/whatsapp.py
Normal file
@@ -0,0 +1,76 @@
|
||||
from pydantic import BaseModel
|
||||
from typing import Optional, List
|
||||
from uuid import UUID
|
||||
from datetime import datetime
|
||||
from app.models.whatsapp import AccountStatus, ConversationStatus, MessageType, MessageDirection, MessageStatus
|
||||
|
||||
|
||||
class WhatsAppAccountCreate(BaseModel):
|
||||
name: str
|
||||
|
||||
|
||||
class WhatsAppAccountResponse(BaseModel):
|
||||
id: UUID
|
||||
phone_number: Optional[str]
|
||||
name: str
|
||||
status: AccountStatus
|
||||
qr_code: Optional[str]
|
||||
created_at: datetime
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class ContactResponse(BaseModel):
|
||||
id: UUID
|
||||
phone_number: str
|
||||
name: Optional[str]
|
||||
email: Optional[str]
|
||||
company: Optional[str]
|
||||
tags: List[str]
|
||||
created_at: datetime
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class MessageResponse(BaseModel):
|
||||
id: UUID
|
||||
direction: MessageDirection
|
||||
type: MessageType
|
||||
content: Optional[str]
|
||||
media_url: Optional[str]
|
||||
status: MessageStatus
|
||||
is_internal_note: bool
|
||||
created_at: datetime
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class ConversationResponse(BaseModel):
|
||||
id: UUID
|
||||
contact: ContactResponse
|
||||
status: ConversationStatus
|
||||
last_message_at: Optional[datetime]
|
||||
created_at: datetime
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class ConversationDetailResponse(ConversationResponse):
|
||||
messages: List[MessageResponse]
|
||||
whatsapp_account: WhatsAppAccountResponse
|
||||
|
||||
|
||||
class SendMessageRequest(BaseModel):
|
||||
type: MessageType = MessageType.TEXT
|
||||
content: str
|
||||
media_url: Optional[str] = None
|
||||
|
||||
|
||||
class InternalEventRequest(BaseModel):
|
||||
type: str
|
||||
accountId: str
|
||||
data: dict
|
||||
Reference in New Issue
Block a user