hotspot / App /Portals /Schema.py
Mbonea's picture
testing deployment
9e798a1
raw
history blame
1.38 kB
from pydantic import BaseModel, Field, HttpUrl
from typing import List, Optional
class BaseResponse(BaseModel):
code: int
message: str
payload: Optional[dict] = None
# Create Portal Request
class CreatePortalRequest(BaseModel):
name: str = Field(
..., max_length=50, description="Name of the portal, e.g., Android or MikroTik"
)
description: str = Field(
..., max_length=255, description="Description of the portal"
)
url: HttpUrl = Field(..., description="URL of the portal")
class Config:
schema_extra = {
"example": {
"name": "Android",
"description": "Official Android developer portal",
"url": "https://developer.android.com",
}
}
# Update Portal Request
class UpdatePortalRequest(BaseModel):
description: Optional[str] = Field(
None, max_length=255, description="Updated description of the portal"
)
url: Optional[HttpUrl] = Field(None, description="Updated URL of the portal")
# Portal Response
class PortalResponse(BaseModel):
id: int
name: str
description: str
url: HttpUrl
class Config:
orm_mode = True
# List of Portals Response
class PortalListResponse(BaseModel):
portals: List[PortalResponse]
total_count: int
class Config:
orm_mode = True