Repository navigation
Feat: 모바일 애플 로그인 - #602
Feat: 모바일 애플 로그인#602
Conversation
[Chore] 배포
[Chore] 배포
[Chore] 배포
[Chore] 배포
[Chore] 배포
[Chore] 배포
📝 WalkthroughWalkthrough백엔드에 모바일 Apple 로그인 기능을 추가합니다. 새 라우트가 Changes모바일 Apple 로그인
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant MobileApp
participant AuthRoute
participant LoginController
participant AppleAuthService
MobileApp->>AuthRoute: POST /app/signin/apple with identityToken
AuthRoute->>LoginController: appAppleLogin(req, res, next)
LoginController->>AppleAuthService: handleAppleLogin(credentials)
AppleAuthService-->>LoginController: authentication result or error
LoginController-->>MobileApp: tokens, user data, or error response
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 oasdiff (1.27.0)src/swagger/swagger.ymlError: failed to load base spec from "/tmp/coderabbit-oasdiff-base.OL8pcC": failed to unmarshal data: json error: invalid character 'o' looking for beginning of value, yaml error: error converting YAML to JSON: yaml: unmarshal errors: Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/controllers/login.controller.js`:
- Around line 435-447: Update the Apple credential validation near the
identityToken and appleUser parsing in the login controller: require
identityToken to be a non-empty string, and reject malformed user JSON or
invalid non-object user values with BadRequestError instead of converting them
to null and continuing. Preserve valid stringified and object user inputs for
token verification.
In `@src/swagger/swagger.yml`:
- Around line 4687-4708: Align the documented 409 response with the behavior of
AppleAuthService.handleAppleLogin: map email uniqueness conflicts to the
project’s conflict error so EMAIL_ALREADY_EXISTS is returned with the documented
payload, or remove the 409 response schema from the Swagger contract if that
mapping is not supported.
- Around line 4653-4658: Update each affected failure response schema in the
Swagger definition to replace the exposed code property with statusCode and
consistently document statusCode, errorCode, reason, and optional data. Apply
the same schema shape to all referenced failure schemas, preserving their
existing examples where applicable.
- Around line 4605-4642: Update the 200 response schema for appAppleLogin to use
oneOf with separate schemas for the normal token payload and the
withdrawn-account payload. Preserve the existing accessToken, refreshToken,
isNewUser, and user shape in one branch, and add withdrawnUser and restoreToken
in the other so generated clients support both flows.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 69475c28-be98-47c1-b2e7-e1be26bb372c
📒 Files selected for processing (4)
src/controllers/login.controller.jssrc/routes/auth.route.jssrc/services/auth.service.jssrc/swagger/swagger.yml
|
Caution Docstrings generation - FAILED No docstrings were generated. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/swagger/swagger.yml`:
- Around line 4611-4662: Update the two schemas in the oneOf response under the
Apple login definition: require resultType, message, and data on each top-level
object, then require accessToken, refreshToken, isNewUser, and user in the
normal-login data schema and withdrawnUser and restoreToken in the
withdrawn-account data schema. Keep the existing property definitions and
examples unchanged.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 5b01d82f-b79b-43bc-a26a-2f11b6739736
📒 Files selected for processing (2)
src/controllers/login.controller.jssrc/swagger/swagger.yml
🚧 Files skipped from review as they are similar to previous changes (1)
- src/controllers/login.controller.js
| oneOf: | ||
| - type: object | ||
| description: "정상 로그인 성공 응답" | ||
| properties: | ||
| resultType: | ||
| type: string | ||
| example: "SUCCESS" | ||
| message: | ||
| type: string | ||
| example: "애플 앱 로그인이 완료되었습니다." | ||
| data: | ||
| type: object | ||
| properties: | ||
| accessToken: | ||
| type: string | ||
| example: "eyJhbGciOiJIUzI1Ni..." | ||
| refreshToken: | ||
| type: string | ||
| example: "8c9d0e11-d3c4..." | ||
| isNewUser: | ||
| type: boolean | ||
| example: false | ||
| user: | ||
| type: object | ||
| properties: | ||
| id: | ||
| type: number | ||
| example: 3 | ||
| email: | ||
| type: string | ||
| example: "test@apple.com" | ||
| nickname: | ||
| type: string | ||
| example: "홍길동" | ||
| - type: object | ||
| description: "탈퇴 처리된 계정으로 로그인 시도한 경우의 응답" | ||
| properties: | ||
| resultType: | ||
| type: string | ||
| example: "SUCCESS" | ||
| message: | ||
| type: string | ||
| example: "탈퇴 처리된 애플 계정입니다." | ||
| data: | ||
| type: object | ||
| properties: | ||
| withdrawnUser: | ||
| type: boolean | ||
| example: true | ||
| restoreToken: | ||
| type: string | ||
| example: "b3a1c2d4-e5f6-7890-abcd-ef1234567890" |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- swagger target ---'
sed -n '4570,4685p' src/swagger/swagger.yml
printf '%s\n' '--- related Apple-login symbols ---'
rg -n -C 3 'withdrawnUser|restoreToken|isNewUser|애플 앱 로그인이 완료되었습니다|탈퇴 처리된 계정' . \
-g '!node_modules' -g '!dist' -g '!build'
printf '%s\n' '--- candidate response declarations ---'
rg -n -C 5 'oneOf:|Apple|apple|애플' src/swagger/swagger.yml | tail -n 240Repository: check-task/backend
Length of output: 34890
🏁 Script executed:
#!/bin/bash
set -e
python3 - <<'PY'
from pathlib import Path
p = Path("src/swagger/swagger.yml")
lines = p.read_text().splitlines()
for n in range(4600, 4668):
print(f"{n+1:5}: {lines[n]}")
PY
printf '%s\n' '--- response-producing code references ---'
rg -n -C 8 'withdrawnUser|restoreToken|isNewUser' . \
-g '!node_modules' -g '!dist' -g '!build' \
-g '*.ts' -g '*.js' -g '*.json' -g '*.yml' -g '*.yaml'
printf '%s\n' '--- available YAML parsers (read-only check) ---'
python3 - <<'PY'
try:
import yaml
print("PyYAML available:", yaml.__version__)
except Exception as exc:
print("PyYAML unavailable:", type(exc).__name__)
PYRepository: check-task/backend
Length of output: 40847
🏁 Script executed:
#!/bin/bash
set -e
python3 - <<'PY'
# Read-only behavioral probe for the two object schemas in the review.
# With no required properties and the OpenAPI default additionalProperties=true,
# each schema accepts every JSON object whose values satisfy any declared
# properties. The probe models the relevant validation rule for the supplied
# response shapes.
schemas = {
"normal": {"accessToken", "refreshToken", "isNewUser", "user"},
"withdrawn": {"withdrawnUser", "restoreToken"},
}
responses = {
"normal response": {
"resultType": "SUCCESS",
"message": "애플 앱 로그인이 완료되었습니다.",
"data": {
"accessToken": "token",
"refreshToken": "refresh",
"isNewUser": False,
"user": {"id": 3},
},
},
"withdrawn response": {
"resultType": "SUCCESS",
"message": "탈퇴 처리된 애플 계정입니다.",
"data": {"withdrawnUser": True, "restoreToken": "restore"},
},
"empty response": {},
}
for response_name, response in responses.items():
matches = []
for schema_name in schemas:
# All declared properties are optional, and undeclared properties are
# allowed by default, so every object matches both branches.
if isinstance(response, dict) and isinstance(response.get("data", {}), dict):
matches.append(schema_name)
print(response_name, "matches", matches, "oneOf-valid=", len(matches) == 1)
PYRepository: check-task/backend
Length of output: 359
oneOf 분기에 필수 필드를 지정하세요.
현재 정상 응답과 탈퇴 응답의 모든 필드가 선택적이고 추가 속성도 허용됩니다. 따라서 실제 두 응답이 모두 두 스키마에 일치하여 oneOf 검증에 실패합니다. 각 최상위 객체에 resultType, message, data를 지정하고, 각 data 객체에 분기별 필수 필드를 지정하세요.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/swagger/swagger.yml` around lines 4611 - 4662, Update the two schemas in
the oneOf response under the Apple login definition: require resultType,
message, and data on each top-level object, then require accessToken,
refreshToken, isNewUser, and user in the normal-login data schema and
withdrawnUser and restoreToken in the withdrawn-account data schema. Keep the
existing property definitions and examples unchanged.
📌 PR 제목 (제목 작성 후 해당 부분은 내용에서 지워주세요!)
[Feat/#이슈 번호] " pr message "
(예시 : [Feat/#1] "로그인 기능 추가")
📌 관련 이슈번호
(Closes 키워드가 있어야 PR이 머지되었을 때 이슈가 자동으로 닫힌다)
📌 PR 유형
어떤 변경 사항이 있나요?
📌 PR 요약
해당 PR을 간단하게 요약해 주세요
📌 작업 세부 내용
📸 스크린샷 (선택)
🔗 참고 자료
Summary by CodeRabbit
새 기능
문서