Skip to content

Commit 4bbba6a

Browse files
committed
Restore profile review context fields expected by the admin UI
The profile review screen was receiving the backend's `context` payload but never normalizing it into the `reviewContext` shape used by the panel. That left several review hints and purchase signals effectively dead even though the data existed. This change maps the backend fields into the frontend shape so the review panel renders the context it already receives. Constraint: The backend returns `context.createdAt` and `purchaseCount`, while the screen expects `reviewContext.userCreatedAt` and `hasPurchased` Rejected: Add a separate adapter layer later | the current screen already has a single normalization point where the mismatch should be corrected Confidence: high Scope-risk: narrow Reversibility: clean Directive: Keep frontend profile-review normalization aligned with backend `context` field names unless the backend is changed to emit `reviewContext` directly Tested: pnpm build Not-tested: Live profile-review panel rendering against production data
1 parent 7631d91 commit 4bbba6a

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

app/admin/profile-review/profile-review-v2.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ function ProfileReviewV2Content() {
288288

289289
// 응답 데이터 정규화 (V2 API 호환성)
290290
const normalizedUsers: PendingUser[] = response.data.map((user: any) => {
291+
const reviewContextSource = user.reviewContext || user.context || null;
291292
// V2: pendingImages[].url, approvedImages[].url / V1: approvedImageUrls[], pendingImages[].imageUrl
292293
const pendingImgs = (user.pendingImages || []).map((img: any) => ({
293294
id: img.imageId ?? img.id,
@@ -316,6 +317,27 @@ function ProfileReviewV2Content() {
316317
// 기본값 설정
317318
preferences: user.preferences || [],
318319
rejectionHistory: user.rejectionHistory || [],
320+
reviewContext: reviewContextSource
321+
? {
322+
reportCount: Number(reviewContextSource.reportCount ?? 0),
323+
hasSuspensionHistory: Boolean(reviewContextSource.hasSuspensionHistory),
324+
userCreatedAt:
325+
reviewContextSource.userCreatedAt ??
326+
reviewContextSource.createdAt ??
327+
user.createdAt ??
328+
"",
329+
isFirstReview: Boolean(reviewContextSource.isFirstReview),
330+
receivedLikeCount: Number(reviewContextSource.receivedLikeCount ?? 0),
331+
matchCount: Number(reviewContextSource.matchCount ?? 0),
332+
chatRoomCount: Number(reviewContextSource.chatRoomCount ?? 0),
333+
hasPurchased:
334+
Boolean(reviewContextSource.hasPurchased) ||
335+
Number(reviewContextSource.purchaseCount ?? 0) > 0 ||
336+
Number(reviewContextSource.totalPurchaseAmount ?? 0) > 0,
337+
totalPurchaseAmount: Number(reviewContextSource.totalPurchaseAmount ?? 0) || undefined,
338+
isUniversityVerified: Boolean(reviewContextSource.isUniversityVerified),
339+
}
340+
: undefined,
319341
isApproved: user.isApproved ?? false,
320342
approved: user.approved ?? false,
321343
createdAt: user.createdAt ?? '',

0 commit comments

Comments
 (0)