Skip to content

fix(admin): 대학교 인증 승인 버튼 — 실제 인증 상태 조회 + 실제 에러 메시지 표시 - #47

Merged
Smartnewb merged 2 commits into
mainfrom
devin/1790172016-univ-verify-btn
Sep 23, 2026
Merged

Smartnewb merged 2 commits into
mainfrom
devin/1790172016-univ-verify-btn

Conversation

@Smartnewb

@Smartnewb Smartnewb commented Sep 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

사용자 상세 모달의 "인증 승인" 버튼이 모든 유저에게 표시되고, 실패 시 "Request failed: 400" 이라는 무의미한 에러만 보이던 문제를 수정합니다.

원인

  • GET /admin/v2/users/:id 응답에 인증 상태(verifiedAt, certificateImageUrl)가 없어 isUniversityVerified가 항상 false → 대학 등록 유저 전원에게 "미인증" + 승인 버튼 표시.
  • 백엔드는 학생증 이미지가 없거나 이미 인증된 경우 400(학생증 이미지가 업로드되지 않은 사용자입니다. / 이미 인증된 사용자입니다.)을 반환하지만, 프론트는 v2 에러 형식 {error: {code, message}}의 message를 읽지 못해 Request failed: 400만 노출.

수정

  • shared/lib/http/admin-fetch.ts: extractErrorMessage() — body.error.message 우선 추출로 모든 어드민 액션에 실제 한글 에러 메시지 노출.
  • userAppearance.getUniversityVerificationStatus() 추가 — 학생증 대기 목록 + 대학 소속 목록(verifiedAt)으로 실제 상태 판정:
    • verified → "✓ 인증됨" 뱃지 (버튼 없음)
    • pending (학생증 제출, 미인증) → "미인증" + 인증 승인 버튼
    • unverified (학생증 미제출) → "미인증" + "학생증 미제출" 힌트 + 인증 승인 버튼 (관리자 수동 승인 — sometimes-api 허용 패치와 짝)
    • 조회 실패/판정 불가 → 기존 동작 유지(버튼 표시), 클릭 시 실제 에러 노출
  • handleUniversityApproval: getAdminErrorMessage로 실제 에러 표시 + "이미 인증된" 에러 시 UI 즉시 인증됨으로 반영.

관련 변경: sometimes-api devin/1790172666-univ-approve-no-cert — 학생증 이미지가 없는 사용자의 승인 차단 400을 제거(관리자 수동 승인 허용). 미제출 유저의 승인이 실제로 성공하려면 해당 백엔드 배포가 필요합니다.

확인

  • 운영 백엔드로 실증: 대상 유저(동아대 수학과)는 verifiedAt: null + 학생증 미제출 → (기존 백엔드) approve 호출 시 400 학생증 이미지가 업로드되지 않은 사용자입니다. 확인.
  • pnpm typecheck:admin-v2 통과, eslint 에러 0, pnpm test:admin 123개 통과.

Link to Devin session: https://app.devin.ai/sessions/b864a162fa6f465587fda88ac2571cf9
Open in Devin Desktop: https://app.devin.ai/desktop/session/b864a162fa6f465587fda88ac2571cf9?variant=devin
Requested by: @Smartnewb

- v2 사용자 상세 응답에 인증 상태(verifiedAt)가 없어 모든 유저가
  '미인증'으로 표시되고 승인 버튼이 노출되던 문제 수정
- 학생증 대기 목록 + 대학 소속 목록(verifiedAt)으로 실제 상태 판정:
  인증됨 / 학생증 제출(승인 가능) / 학생증 미제출(승인 불가, 버튼 숨김)
- AdminApiError 가 v2 에러 형식 {error:{message}} 의 실제 메시지를
  읽지 못해 'Request failed: 400' 만 보이던 문제 수정
- '이미 인증된 사용자' 에러 시 UI 상태를 즉시 인증됨으로 반영

Co-Authored-By: Newbie Smart <smartnewb2@gmail.com>
@Smartnewb Smartnewb self-assigned this Sep 23, 2026
@vercel

vercel Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
project-solo Ready Ready Preview Sep 23, 2026 2:18pm UTC

Request Review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-23T14:24:26.733096Z df34e18 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 74e54fda18

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +875 to +876
page: 1,
limit: 100,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 대기 목록의 모든 페이지를 확인하세요

인증 대기 API는 totalPages를 반환하는 페이지네이션 목록인데 여기서는 첫 100건만 조회합니다. 같은 이름·대학의 검색 결과가 100건을 넘거나 이름 필터가 없는 사용자라면 후속 페이지의 실제 신청자를 놓치며, 이후 소속 정보의 verifiedAt: null을 근거로 unverified를 반환해 학생증을 제출한 사용자를 "학생증 미제출"로 표시하고 승인 버튼까지 숨깁니다. userId로 직접 조회하거나 totalPages까지 검색해야 합니다.

Useful? React with 👍 / 👎.

학생증 미제출 유저에게도 인증 승인 버튼 표시 + '학생증 미제출' 힌트 유지.

Co-Authored-By: Newbie Smart <smartnewb2@gmail.com>
@sonarqubecloud

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: df34e18a0c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

학생증 미제출
</Typography>
)}
{uniVerificationStatus !== 'loading' && (

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 학생증 미제출 시 승인 버튼을 숨기세요

uniVerificationStatus가 unverified인 경우에도 이 조건은 참이므로, "학생증 미제출" 문구와 인증 승인 버튼이 동시에 표시됩니다. 백엔드는 학생증이 없는 사용자의 승인을 거부하므로 해당 버튼은 항상 실패하며, 상태가 pending 또는 판정 불가인 경우에만 노출하도록 조건에서 unverified를 제외해야 합니다.

Useful? React with 👍 / 👎.

};
}, [open, userDetail?.id, userDetail?.name, isUniversityVerified, currentUniversityName]);

const showUniversityVerified = isUniversityVerified || uniVerificationStatus === 'verified';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 확인된 인증 상태를 학교 변경 모달에도 전달하세요

v2 상세 응답에 인증 필드가 없는 검증 완료 사용자는 여기서만 uniVerificationStatus === 'verified'를 반영하므로, 본문에는 "인증됨"이 표시되지만 UniversityTransferModal에는 여전히 원래의 isUniversityVerified(false)가 전달되고 성공 처리에서도 authentication: false가 기록됩니다. 이 사용자가 변경을 열면 같은 화면에서 "미인증"으로 표시되고 변경 직후 로컬 상태도 미인증으로 되돌아가므로, 새로 계산한 상태를 모달과 성공 처리에도 일관되게 사용해야 합니다.

Useful? React with 👍 / 👎.

@Smartnewb
Smartnewb merged commit df34e18 into main Sep 23, 2026
4 checks passed

This branch was successfully deployed

2 active deployments
Production — df34e18a Deployed Sep 23, 2026 by vercel[bot]
Preview — df34e18a Deployed Sep 23, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants