From 6892880c16af3eb0027a77c9695b2fe462b4761e Mon Sep 17 00:00:00 2001 From: joonhoekim <26rote@gmail.com> Date: Tue, 14 Oct 2025 17:24:40 +0900 Subject: (김준회) S-GIPS 유저 로그인 SMS 송신 오류 개선 및 로깅 추가 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/auth/send-sms/route.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'app/api') diff --git a/app/api/auth/send-sms/route.ts b/app/api/auth/send-sms/route.ts index 805ff7f7..707741dc 100644 --- a/app/api/auth/send-sms/route.ts +++ b/app/api/auth/send-sms/route.ts @@ -4,6 +4,7 @@ import { NextRequest, NextResponse } from 'next/server'; import { z } from 'zod'; import { getUserById } from '@/lib/users/repository'; import { generateAndSendSmsToken } from '@/lib/users/auth/passwordUtil'; +import { debugLog, debugSuccess, debugError } from '@/lib/debug-utils'; const sendSmsSchema = z.object({ userId: z.number(), @@ -15,7 +16,11 @@ export async function POST(request: NextRequest) { const body = await request.json(); const { userId } = sendSmsSchema.parse(body); - console.log(userId, "userId") + debugLog('SMS 전송 요청', { + userId, + receivedPhone: body.phone, + receivedName: body.name + }); // 본인 확인 if (!userId) { @@ -28,15 +33,19 @@ export async function POST(request: NextRequest) { // 사용자 정보 조회 const user = await getUserById(userId); if (!user || !user.phone) { + debugError('사용자 정보 조회 실패', { userId, userFound: !!user, phoneExists: !!user?.phone }); return NextResponse.json( { error: '전화번호가 등록되지 않았습니다' }, { status: 400 } ); } - console.log(user, "user") - - + debugSuccess('DB에서 조회된 사용자 정보', { + userId: user.id, + email: user.email, + phone: user.phone, + name: user.name + }); // SMS 전송 const result = await generateAndSendSmsToken(Number(userId), user.phone); -- cgit v1.2.3