summaryrefslogtreecommitdiff
path: root/app/api/auth
diff options
context:
space:
mode:
authorjoonhoekim <26rote@gmail.com>2025-10-14 17:24:40 +0900
committerjoonhoekim <26rote@gmail.com>2025-10-14 17:24:40 +0900
commit6892880c16af3eb0027a77c9695b2fe462b4761e (patch)
treea650a131cf46af00048b10db873eea70dc7196cd /app/api/auth
parentb61931f50ba63f9a91ac8eb01fd91aa6e2fb6119 (diff)
(김준회) S-GIPS 유저 로그인 SMS 송신 오류 개선 및 로깅 추가
Diffstat (limited to 'app/api/auth')
-rw-r--r--app/api/auth/send-sms/route.ts17
1 files changed, 13 insertions, 4 deletions
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);