- 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>
55 lines
2.2 KiB
Python
55 lines
2.2 KiB
Python
from pydantic import Field
|
|
|
|
from common.models.gmodel import Res_WebPacketProtocol, WebPacketProtocol
|
|
|
|
|
|
# 라우터 폴더마다 protocol.py 를 두고 Req_/Res_ 를 정의한다 (protocol 규약).
|
|
class AuthProtocol(WebPacketProtocol):
|
|
pass
|
|
|
|
|
|
class Req_Login(AuthProtocol):
|
|
id: str = Field("", description="로그인 ID")
|
|
pw: str = Field("", description="비밀번호(평문, 서버에서 bcrypt 해시·검증)")
|
|
|
|
|
|
class Res_Login(Res_WebPacketProtocol):
|
|
su_id: str = Field("", description="유저 식별자(uuid)")
|
|
name: str = Field("", description="유저 개인 이름")
|
|
supplier_id: str = Field("", description="소속 공급사 uuid(partner.suppliers)")
|
|
supplier_name: str = Field("", description="공급사명")
|
|
role: int = Field(0, description="권한 코드 1=user, 2=manager (UserRole)")
|
|
access_token: str = Field("", description="액세스 토큰(JWT)")
|
|
refresh_token: str = Field("", description="리프레시 토큰(JWT)")
|
|
|
|
|
|
class Req_CreateAccount(AuthProtocol):
|
|
supplier_id: str = Field("", max_length=36, description="소속 공급사 uuid(partner.suppliers.supplier_id)")
|
|
id: str = Field("", max_length=20, description="로그인 ID")
|
|
pw: str = Field("", description="비밀번호(평문, 서버에서 bcrypt 해시)")
|
|
name: str = Field("", max_length=50, description="이름")
|
|
email: str = Field("", max_length=255, description="이메일")
|
|
contact_number: str = Field("", max_length=20, description="연락처")
|
|
role: int = Field(1, description="권한 코드 1=user, 2=manager (UserRole)")
|
|
|
|
|
|
class Res_CreateAccount(Res_WebPacketProtocol):
|
|
su_id: str = ""
|
|
|
|
|
|
class Res_RefreshToken(Res_WebPacketProtocol):
|
|
access_token: str = Field("", description="재발급된 액세스 토큰(JWT)")
|
|
|
|
|
|
class Res_Me(Res_WebPacketProtocol):
|
|
su_id: str = Field("", description="유저 식별자(uuid)")
|
|
id: str = Field("", description="로그인 ID")
|
|
name: str = Field("", description="유저 개인 이름")
|
|
supplier_id: str = Field("", description="소속 공급사 uuid")
|
|
supplier_name: str = Field("", description="공급사명")
|
|
role: int = Field(0, description="권한 코드 1=user, 2=manager (UserRole)")
|
|
|
|
|
|
class Res_Logout(Res_WebPacketProtocol):
|
|
pass
|