A1: corp_brand_resolver JWT 자동 통합 (회귀 fix)#189
Merged
Conversation
PR #188 의 corp_brand_resolver 가 frontend 가 biz_number 명시 안 보내면 검증 skip 되는 회귀 fix. JWT 토큰에서 자동 추출. 추가: - _resolve_user_biz_number(user) — JWT UserContext → users.biz_number 조회 * master role: user_id → users.id 매칭 * manager role: owner_id → users.id 매칭 (소속 owner) - _validate_and_resolve_brand(input_data, current_user) 시그니처 확장 - biz_number 우선순위: 1. input_data.biz_number (frontend 명시) 2. JWT 토큰의 user.user_id 또는 owner_id → users.biz_number 3. 없으면 검증 skip (비회원/개인사업자 호환) 7 endpoint 시그니처에 Depends(get_optional_user) 추가: - /analyze, /analyze/llm, /analyze/llm/async, /analyze/quick - /predict, /predict/async, /simulate import: - from fastapi import Depends 추가 - from src.services.jwt_auth import UserContext, get_optional_user 기존 동작 유지: - 비로그인 사용자 → optional auth, current_user=None → skip (기존과 동일) - frontend biz_number 명시 → 토큰 무시 (frontend 우선) - frontend biz_number 없음 + 로그인 → 토큰에서 자동 추출 (이번 fix) DB 변경: 0 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR #188 회귀 fix: frontend 가 biz_number 안 보내면 검증 skip 되던 문제 → JWT 토큰에서 자동 추출.
변경
_resolve_user_biz_number(user)— JWT UserContext → users.biz_number 자동 조회_validate_and_resolve_brand시그니처에current_user추가Depends(get_optional_user)추가biz_number 우선순위
input_data.biz_number(frontend 명시)적용 endpoint
/analyze,/analyze/llm,/analyze/llm/async,/analyze/quick,/predict,/predict/async,/simulateDB 변경
없음.
🤖 Generated with Claude Code