feat(backend): 협상 세션 목록 + 참여 기능
- GET /v1/negotiation/sessions: 로그인 공급사의 세션 목록(필터/정렬/페이지네이션)
· qt_end_time 은 견적(quotation.end_time) 기준, sessions⨝items⨝quotations 조인
· status/qt_type 은 정수 코드로 응답(라벨 매핑은 프론트)
- POST /v1/negotiation/sessions/{session_id}/participate: 협상 참여
· 검증: 소유(공급사 대조)→세션상태→견적마감→마감시간, 에러코드 1300~1304
· 협상생성→협상중, 견적→견적진행중 (협상중/완료는 무변경 진입)
· 마감초과 시 협상생성 세션만 미참여로 정리
- DBType.NEGOTIATION/QUOTATION, items/sessions/quotations 모델
- QtType/SessionStatus/QuotationStatus enum, AuthService.authenticate 공통화
- 협상 e2e 테스트(test_negotiation.py)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
16848e9f63
commit
2480a47efe
10 files changed
+735
-10
No files matched your search
+40
-2
@@ -37,6 +37,13 @@ class ErrorType(Enum):
|
||||
ACCOUNT_BLOCKED_USER = auto()
|
||||
TOKEN_REVOKED = auto() # 제시된 토큰이 저장된 토큰과 불일치(로그아웃/타기기 로그인으로 교체됨)
|
||||
|
||||
# 협상(negotiation) 관련 에러 — 프론트 toast 용 코드
|
||||
NEGO_FORBIDDEN = 1300 # 공급사 불일치(권한 없음)
|
||||
NEGO_NOT_PARTICIPABLE = auto() # 1301 세션 상태가 미참여/협상거부라 참여 불가
|
||||
NEGO_QUOTATION_CLOSED = auto() # 1302 견적 마감 상태
|
||||
NEGO_DEADLINE_PASSED = auto() # 1303 견적 마감 시간 초과
|
||||
NEGO_NOT_FOUND = auto() # 1304 세션/견적 없음
|
||||
|
||||
|
||||
# ErrorType 의 HTTP_* 값과 status_code 를 맞춰 router 단에서 raise 한다.
|
||||
EXCEPTION_INVALID_CLIENT_REQUEST = HTTPException(status_code=ErrorType.HTTP_INVALID_CLIENT_REQUEST.value, detail=ErrorType.HTTP_INVALID_CLIENT_REQUEST.name)
|
||||
@@ -53,8 +60,10 @@ class DBType(Enum):
|
||||
물리적으로 같은 negosium_db 라도 도메인별 논리 구분으로 나눠 둘 수 있다(커넥션 config 는 재사용).
|
||||
"""
|
||||
|
||||
USER = 1 # 기본 유저 (supplier_users 테이블)
|
||||
PARTNER = 2 # partner 도메인 (partner.suppliers 등)
|
||||
USER = 1 # 기본 유저 (supplier_users 테이블)
|
||||
PARTNER = 2 # partner 도메인 (partner.suppliers, partner.items 등)
|
||||
NEGOTIATION = 3 # negotiation 도메인 (negotiation.sessions 등)
|
||||
QUOTATION = 4 # quotation 도메인 (quotation.quotations 등)
|
||||
|
||||
|
||||
class DBWRType(Enum):
|
||||
@@ -87,3 +96,32 @@ class TokenType(Enum):
|
||||
|
||||
ACCESS = 1
|
||||
REFRESH = 2
|
||||
|
||||
|
||||
class QtType(Enum):
|
||||
"""견적/세션 유형 코드. quotation.quotations.type / negotiation.sessions.qt_type."""
|
||||
|
||||
RENEGO = 1 # 재협상(1:1)
|
||||
REQUOTE = 2 # 재견적(1:N)
|
||||
|
||||
|
||||
class SessionStatus(Enum):
|
||||
"""협상 세션 진행 상태 코드. negotiation.sessions.status.
|
||||
⚠️ 세션을 생성/갱신하는 쪽(바이어/agent)과 코드값이 일치해야 한다.
|
||||
"""
|
||||
|
||||
CREATED = 1 # 협상생성
|
||||
IN_PROGRESS = 2 # 협상중
|
||||
DONE = 3 # 협상완료
|
||||
NOT_PARTICIPATED = 4 # 미참여
|
||||
REJECTED = 5 # 협상거부
|
||||
|
||||
|
||||
class QuotationStatus(Enum):
|
||||
"""견적 진행 상태 코드. quotation.quotations.status.
|
||||
⚠️ 견적을 생성/갱신하는 쪽(바이어/agent)과 코드값이 일치해야 한다.
|
||||
"""
|
||||
|
||||
CREATED = 1 # 견적생성
|
||||
IN_PROGRESS = 2 # 견적진행중
|
||||
CLOSED = 3 # 견적마감
|
||||
Reference in new issue
Block a user