Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions apps/pre-processing-service/app/api/endpoints/blog.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@
router = APIRouter()


@router.get("/", summary="블로그 API 상태 확인")
async def root():
return {"message": "blog API"}


@router.post(
"/rag/create",
response_model=ResponseBlogCreate,
Expand Down Expand Up @@ -49,9 +44,7 @@ async def publish(request: RequestBlogPublish):
raise CustomException(
"네이버 블로그 포스팅에 실패했습니다.", status_code=500
)
return ResponseBlogPublish(
job_id=1, schedule_id=1, schedule_his_id=1, status="200", metadata=result
)
return ResponseBlogPublish(status="success", metadata=result)

elif request.tag == "tistory":
tistory_service = TistoryBlogPostService()
Expand All @@ -66,9 +59,7 @@ async def publish(request: RequestBlogPublish):
"티스토리 블로그 포스팅에 실패했습니다.", status_code=500
)

return ResponseBlogPublish(
job_id=1, schedule_id=1, schedule_his_id=1, status="200", metadata=result
)
return ResponseBlogPublish(status="success", metadata=result)

elif request.tag == "blogger":
blogger_service = BloggerBlogPostService()
Expand All @@ -83,6 +74,4 @@ async def publish(request: RequestBlogPublish):
"블로거 블로그 포스팅에 실패했습니다.", status_code=500
)

return ResponseBlogPublish(
job_id=1, schedule_id=1, schedule_his_id=1, status="200", metadata=result
)
return ResponseBlogPublish(status="success", metadata=result)
8 changes: 0 additions & 8 deletions apps/pre-processing-service/app/api/endpoints/keywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@
router = APIRouter()


@router.get("/", summary="키워드 API 상태 확인")
async def root():
"""
키워드 API가 정상 동작하는지 확인
"""
return {"message": "keyword API"}


@router.post(
"/search", response_model=ResponseNaverSearch, summary="네이버 키워드 검색"
)
Expand Down
8 changes: 0 additions & 8 deletions apps/pre-processing-service/app/api/endpoints/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@
router = APIRouter()


@router.get("/", summary="상품 API 상태 확인")
async def root():
"""
상품 API 서버 상태 확인용 엔드포인트
"""
return {"message": "product API"}


@router.post("/search", response_model=ResponseSadaguSearch, summary="상품 검색")
async def search(request: RequestSadaguSearch):
"""
Expand Down
5 changes: 0 additions & 5 deletions apps/pre-processing-service/app/api/endpoints/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@
router = APIRouter()


@router.get("/")
async def root():
return {"message": "테스트 API"}


@router.get("/hello/{name}", tags=["hello"])
# @log_api_call
async def say_hello(name: str):
Expand Down
38 changes: 20 additions & 18 deletions apps/pre-processing-service/app/model/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,31 @@

# 기본 요청
class RequestBase(BaseModel):
job_id: int = Field(
..., title="작업 ID", description="현재 실행 중인 작업의 고유 식별자"
)
schedule_id: int = Field(
..., title="스케줄 ID", description="예약된 스케줄의 고유 식별자"
)
schedule_his_id: Optional[int] = Field(
None, title="스케줄 히스토리 ID", description="스케줄 실행 이력의 고유 식별자"
)
# job_id: int = Field(
# ..., title="작업 ID", description="현재 실행 중인 작업의 고유 식별자"
# )
# schedule_id: int = Field(
# ..., title="스케줄 ID", description="예약된 스케줄의 고유 식별자"
# )
# schedule_his_id: Optional[int] = Field(
# None, title="스케줄 히스토리 ID", description="스케줄 실행 이력의 고유 식별자"
# )
pass


# 기본 응답
class ResponseBase(BaseModel):
job_id: int = Field(
..., title="작업 ID", description="현재 실행 중인 작업의 고유 식별자"
)
schedule_id: int = Field(
..., title="스케줄 ID", description="예약된 스케줄의 고유 식별자"
)
schedule_his_id: Optional[int] = Field(
None, title="스케줄 히스토리 ID", description="스케줄 실행 이력의 고유 식별자"
)
# job_id: int = Field(
# ..., title="작업 ID", description="현재 실행 중인 작업의 고유 식별자"
# )
# schedule_id: int = Field(
# ..., title="스케줄 ID", description="예약된 스케줄의 고유 식별자"
# )
# schedule_his_id: Optional[int] = Field(
# None, title="스케줄 히스토리 ID", description="스케줄 실행 이력의 고유 식별자"
# )
status: str = Field(..., title="상태", description="요청 처리 상태")
pass


# 네이버 키워드 추출
Expand Down
17 changes: 9 additions & 8 deletions apps/pre-processing-service/app/service/match_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@ def match_products(self, request: RequestSadaguMatch) -> dict:
products = request.search_results

logger.info(
f"키워드 매칭 서비스 시작: job_id={request.job_id}, schedule_id={request.schedule_id}, keyword='{keyword}', products_count={len(products) if products else 0}"
# f"키워드 매칭 서비스 시작: job_id={request.job_id}, schedule_id={request.schedule_id}, keyword='{keyword}', products_count={len(products) if products else 0}"
f"keyword='{keyword}'"
)

if not products:
logger.warning(f"매칭할 상품이 없음: keyword='{keyword}'")
return {
"job_id": request.job_id,
"schedule_id": request.schedule_id,
"schedule_his_id": request.schedule_his_id,
# "job_id": request.job_id,
# "schedule_id": request.schedule_id,
# "schedule_his_id": request.schedule_his_id,
"keyword": keyword,
"matched_products": [],
"status": "success",
Expand Down Expand Up @@ -80,16 +81,16 @@ def match_products(self, request: RequestSadaguMatch) -> dict:
)

return {
"job_id": request.job_id,
"schedule_id": request.schedule_id,
"schedule_his_id": request.schedule_his_id,
# "job_id": request.job_id,
# "schedule_id": request.schedule_id,
# "schedule_his_id": request.schedule_his_id,
"keyword": keyword,
"matched_products": matched_products,
"status": "success",
}

except Exception as e:
logger.error(
f"매칭 서비스 오류: job_id={request.job_id}, keyword='{keyword}', error='{e}'"
# f"매칭 서비스 오류: job_id={request.job_id}, keyword='{keyword}', error='{e}'"
)
raise InvalidItemDataException()
15 changes: 8 additions & 7 deletions apps/pre-processing-service/app/service/search_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ async def search_products(self, request: RequestSadaguSearch) -> dict:

try:
logger.info(
f"상품 검색 서비스 시작: job_id={request.job_id}, schedule_id={request.schedule_id}, keyword='{keyword}'"
# f"상품 검색 서비스 시작: job_id={request.job_id}, schedule_id={request.schedule_id}, keyword='{keyword}'"
f"keyword='{keyword}'"
)

# Selenium 또는 httpx로 상품 검색
Expand All @@ -29,9 +30,9 @@ async def search_products(self, request: RequestSadaguSearch) -> dict:
if not search_results:
logger.warning(f"검색 결과가 없습니다: keyword='{keyword}'")
return {
"job_id": request.job_id,
"schedule_id": request.schedule_id,
"schedule_his_id": request.schedule_his_id,
# "job_id": request.job_id,
# "schedule_id": request.schedule_id,
# "schedule_his_id": request.schedule_his_id,
"keyword": keyword,
"search_results": [],
"status": "success",
Expand Down Expand Up @@ -90,9 +91,9 @@ async def search_products(self, request: RequestSadaguSearch) -> dict:
)

return {
"job_id": request.job_id,
"schedule_id": request.schedule_id,
"schedule_his_id": request.schedule_his_id,
# "job_id": request.job_id,
# "schedule_id": request.schedule_id,
# "schedule_his_id": request.schedule_his_id,
"keyword": keyword,
"search_results": enriched_results,
"status": "success",
Expand Down
Loading