- 백엔드: 도메인 enum CodeEnum 상속(x-enum-varnames) → orval이 이름 있는 enum 생성. 응답 필드 enum 타입 지정(요청은 int 유지). ENUM_LABELS/DOMAIN_ENUMS·/v1/enums 제거 - 프론트: 생성 enum + 라벨맵으로 교체(매직넘버·발명 어휘 제거), 견적·세션 상태 코드화, role/delivery 라벨 프론트 소유 - 동반 정리: unwrap 캐스트·목업(buildSessions·데모)·死코드 제거, mapItem toMinPrice dedupe Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
57 lines
1.2 KiB
Python
57 lines
1.2 KiB
Python
from typing import Optional
|
|
|
|
from pydantic import Field
|
|
|
|
from common.enums import UserRole
|
|
from common.models.gmodel import Res_WebPacketProtocol, WebPacketProtocol
|
|
|
|
|
|
# 라우터 폴더마다 protocol.py 를 두고 Req_/Res_ 를 정의한다 (protocol 규약).
|
|
class AuthProtocol(WebPacketProtocol):
|
|
pass
|
|
|
|
|
|
class Req_Login(AuthProtocol):
|
|
id: str = ""
|
|
password: str = ""
|
|
|
|
|
|
class Res_Login(Res_WebPacketProtocol):
|
|
access_token: str = ""
|
|
refresh_token: str = ""
|
|
token_type: str = "bearer"
|
|
|
|
|
|
class Req_CreateAccount(AuthProtocol):
|
|
id: str = ""
|
|
password: str = ""
|
|
company_id: str = ""
|
|
name: str = ""
|
|
email: str = ""
|
|
contact_number: str = ""
|
|
role: int = UserRole.USER.value
|
|
|
|
|
|
class Res_CreateAccount(Res_WebPacketProtocol):
|
|
user_id: str = ""
|
|
|
|
|
|
class Res_RefreshToken(Res_WebPacketProtocol):
|
|
access_token: str = ""
|
|
token_type: str = "bearer"
|
|
|
|
|
|
class CompanyData(WebPacketProtocol):
|
|
company_id: str = ""
|
|
name: str = ""
|
|
|
|
|
|
class Res_Me(Res_WebPacketProtocol):
|
|
user_id: str = ""
|
|
id: str = ""
|
|
name: Optional[str] = None
|
|
email: Optional[str] = None
|
|
contact_number: Optional[str] = None
|
|
role: UserRole = UserRole.USER
|
|
company: Optional[CompanyData] = Field(default=None)
|