nomadweb/backend/app/schemas.py
2026-08-28 19:49:10 -05:00

165 lines
2.7 KiB
Python

from pydantic import BaseModel, EmailStr, Field
class Destination(BaseModel):
id: str
slug: str
name: str
country: str
emoji: str
tag: str
description: str
region: str
cost: int
speed: int
temperature: int
rating: float
hue: int = 170
nomads_count: str = "5,000+"
highlights: list[str] = []
map_x: float = 0
map_y: float = 0
class Visa(BaseModel):
id: str
country: str
flag: str
name: str
badge: str
badge_type: str
duration: str
income_req: str
approval_time: str
extra: str
difficulty: int
difficulty_label: str
class FAQ(BaseModel):
id: str
question: str
answer: str
order: int = 0
class Testimonial(BaseModel):
id: str
avatar: str
content: str
author: str
role: str
rating: int = 5
class Tool(BaseModel):
id: str
emoji: str
name: str
description: str
tags: list[str]
category: str
class SubscribeRequest(BaseModel):
email: EmailStr
class SubscribeResponse(BaseModel):
success: bool
message: str
class CostCalculatorRequest(BaseModel):
destination_slug: str
housing: str = "mid" # budget | mid | premium
months: int = Field(default=1, ge=1, le=24)
class CostCalculatorResponse(BaseModel):
destination: str
emoji: str
months: int
breakdown: dict[str, int]
total: int
per_month: int
class CompareRequest(BaseModel):
slugs: list[str] = Field(..., min_length=2, max_length=4)
class StatsResponse(BaseModel):
countries: int
avg_cost: int
satisfaction: int
total_nomads: str
active_today: int
class ChartData(BaseModel):
labels: list[str]
datasets: list[dict]
class BlogPost(BaseModel):
id: str
slug: str
title: str
excerpt: str
emoji: str
author: str
published_at: str
read_time: int
tags: list[str] = []
class BlogPostDetail(BlogPost):
content: str
class AuthRegister(BaseModel):
email: EmailStr
password: str = Field(min_length=6)
name: str = Field(min_length=1)
class AuthLogin(BaseModel):
email: EmailStr
password: str
class UserProfile(BaseModel):
id: str
email: str
name: str
avatar: str = "🧑‍💻"
class AuthResponse(BaseModel):
token: str
user: UserProfile
class FavoriteRequest(BaseModel):
destination_slug: str
class FavoriteResponse(BaseModel):
slugs: list[str]
class ProfileStats(BaseModel):
favorites_count: int
destinations_explored: int
member_since: str
nomad_level: str
class SearchResult(BaseModel):
type: str # destination | blog | visa | faq
title: str
subtitle: str
emoji: str
url: str