[refactor] backend services/router 정리 — chat 분리·staticmethod 집약·protocol 문서화·테스트 보강
- router: 채팅 라우터/프로토콜을 negotiation/ 에서 chat/ 으로 분리(git mv, URL 유지). chat_protocol.py → chat/protocol.py (폴더당 protocol.py convention 복원), router 등록·import 갱신. - chat_service: 순수 헬퍼/매퍼를 모듈 함수 → 클래스 @staticmethod 로 이동하고 클래스 상단에 집약. - protocol: Req 모델 + 코드/enum 필드에 Field(description=...) 추가(Swagger 노출), Req 문자열 필드에 max_length(DB 컬럼 정합) 추가 → 초과 입력이 DB 오류 대신 422. - models: updated_at 에 onupdate 추가 → UPDATE 시 자동 갱신(negodata convention 일치). - tests: negotiation reject e2e 6케이스 + chat 순수 헬퍼 단위 4케이스 추가(45→55 passed). - enums: 장황한 주석/docstring 축약(코드값 변경 없음). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
b4dc862912
commit
1a933409a3
10 files changed
+261
-177
No files matched your search
+6
-18
@@ -81,10 +81,6 @@ class DBWRType(Enum):
|
||||
DB_WRITE = 2
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 도메인 코드값. 스키마는 SMALLINT 정수 코드(1부터)로 두고, 의미 매핑은 여기 enum 으로 한다.
|
||||
# (postgres-init/01-schema.sql: "코드값(status/role/type 등)은 SMALLINT 정수 코드로 둔다")
|
||||
# ============================================================
|
||||
class AccountStatus(Enum):
|
||||
"""계정 상태 코드. company.users / supplier.supplier_users 의 status 컬럼."""
|
||||
|
||||
@@ -114,9 +110,7 @@ class QtType(Enum):
|
||||
|
||||
|
||||
class SessionStatus(Enum):
|
||||
"""협상 세션 진행 상태 코드. negotiation.sessions.status.
|
||||
⚠️ 세션을 생성/갱신하는 쪽(바이어/agent)과 코드값이 일치해야 한다.
|
||||
"""
|
||||
"""협상 세션 진행 상태 코드. negotiation.sessions.status"""
|
||||
|
||||
CREATED = 1 # 협상생성
|
||||
IN_PROGRESS = 2 # 협상중
|
||||
@@ -126,9 +120,7 @@ class SessionStatus(Enum):
|
||||
|
||||
|
||||
class QuotationStatus(Enum):
|
||||
"""견적 진행 상태 코드. quotation.quotations.status.
|
||||
⚠️ 견적을 생성/갱신하는 쪽(바이어/agent)과 코드값이 일치해야 한다.
|
||||
"""
|
||||
"""견적 진행 상태 코드. quotation.quotations.status """
|
||||
|
||||
CREATED = 1 # 견적생성
|
||||
IN_PROGRESS = 2 # 견적진행중
|
||||
@@ -136,18 +128,14 @@ class QuotationStatus(Enum):
|
||||
|
||||
|
||||
class ChatSender(Enum):
|
||||
"""채팅 발신자 코드. negotiation.chats.sender.
|
||||
BOT 은 갑(바이어/agent)이 제시하는 협상 메시지, USER 는 공급사(접속 유저)의 입력이다.
|
||||
"""
|
||||
"""채팅 발신자 코드. negotiation.chats.sender """
|
||||
|
||||
BOT = 1 # 갑(바이어/agent) — bot 메시지
|
||||
USER = 2 # 공급사(을) — user 입력
|
||||
BOT = 1 # 공급사(갑) — bot 메시지
|
||||
USER = 2 # 협력사(을) — user 입력
|
||||
|
||||
|
||||
class DeliveryType(Enum):
|
||||
"""배송 유형 코드. partner.items.delivery_type / negotiation.sessions.reject_delivery_type.
|
||||
재견적(CM) 협상의 '배송형태선택' 단계 라벨과 1:1 (SHARED_ENUMS §6, negodata 정의 채택).
|
||||
"""
|
||||
"""배송 유형 코드. partner.items.delivery_type / negotiation.sessions.reject_delivery_type """
|
||||
|
||||
SUPPLIER = 1 # 협력사배송
|
||||
COURIER = 2 # 지정택배배송
|
||||
|
||||
Reference in new issue
Block a user