diff options
Diffstat (limited to 'app/api/auth/send-sms/route.ts')
| -rw-r--r-- | app/api/auth/send-sms/route.ts | 17 |
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); |
