69 lines
2.6 KiB
Python
69 lines
2.6 KiB
Python
# app/models/restaurant_models.py
|
|
from pydantic import BaseModel, Field
|
|
from typing import List, Optional
|
|
|
|
class RestaurantSearchRequest(BaseModel):
|
|
"""음식점 검색 요청 모델"""
|
|
region: str = Field(
|
|
...,
|
|
description="지역 (시군구 + 읍면동)",
|
|
example="서울특별시 강남구 역삼동"
|
|
)
|
|
store_name: str = Field(
|
|
...,
|
|
description="가게명",
|
|
example="맛있는 한식당"
|
|
)
|
|
|
|
class RestaurantInfo(BaseModel):
|
|
"""음식점 정보 모델"""
|
|
id: str = Field(description="카카오 장소 ID")
|
|
place_name: str = Field(description="장소명")
|
|
category_name: str = Field(description="카테고리명")
|
|
category_group_code: str = Field(description="카테고리 그룹 코드")
|
|
category_group_name: str = Field(description="카테고리 그룹명")
|
|
phone: str = Field(description="전화번호")
|
|
address_name: str = Field(description="전체 지번 주소")
|
|
road_address_name: str = Field(description="전체 도로명 주소")
|
|
place_url: str = Field(description="장소 상세페이지 URL")
|
|
distance: str = Field(description="중심좌표까지의 거리 (meter)")
|
|
x: str = Field(description="X 좌표값, 경위도인 경우 longitude")
|
|
y: str = Field(description="Y 좌표값, 경위도인 경우 latitude")
|
|
|
|
class SimilarRestaurantsRequest(BaseModel):
|
|
"""동종 업체 검색 요청 모델"""
|
|
region: str = Field(
|
|
...,
|
|
description="지역",
|
|
example="서울특별시 강남구"
|
|
)
|
|
food_category: str = Field(
|
|
...,
|
|
description="음식 종류",
|
|
example="육류,고기"
|
|
)
|
|
max_count: int = Field(
|
|
default=50,
|
|
description="최대 검색 개수",
|
|
example=50
|
|
)
|
|
|
|
class RestaurantSearchResponse(BaseModel):
|
|
"""음식점 검색 응답 모델"""
|
|
success: bool = Field(description="검색 성공 여부")
|
|
message: str = Field(description="응답 메시지")
|
|
restaurant: Optional[RestaurantInfo] = Field(description="찾은 음식점 정보")
|
|
|
|
class SimilarRestaurantsResponse(BaseModel):
|
|
"""동종 업체 검색 응답 모델"""
|
|
success: bool = Field(description="검색 성공 여부")
|
|
message: str = Field(description="응답 메시지")
|
|
restaurants: List[RestaurantInfo] = Field(description="동종 업체 목록")
|
|
total_count: int = Field(description="총 검색된 업체 수")
|
|
|
|
class ErrorResponse(BaseModel):
|
|
"""에러 응답 모델"""
|
|
success: bool = False
|
|
error: str = Field(description="에러 코드")
|
|
message: str = Field(description="에러 메시지")
|
|
timestamp: str = Field(description="에러 발생 시간") |