Skip to content
Snippets Groups Projects
Commit 208d329f authored by 조대희's avatar 조대희
Browse files

refactor: 데이터 log 추가

parent af906d5f
No related branches found
No related tags found
1 merge request!43배포코드 master브랜치로
...@@ -97,9 +97,29 @@ class friendController { ...@@ -97,9 +97,29 @@ class friendController {
async acceptRequest(req, res) { async acceptRequest(req, res) {
try { try {
return await performanceMonitor.measureAsync('acceptFriendRequest', async () => { return await performanceMonitor.measureAsync('acceptFriendRequest', async () => {
if (!req.user || !req.user.id) {
return res.status(401).json({
success: false,
error: {
message: '인증되지 않은 사용자입니다.',
code: 'UNAUTHORIZED'
}
});
}
const userId = req.user.id; const userId = req.user.id;
const { friendId } = req.params; const friendId = parseInt(req.params.friendId, 10);
if (!friendId || isNaN(friendId)) {
return res.status(400).json({
success: false,
error: {
message: '유효하지 않은 친구 ID입니다.',
code: 'INVALID_FRIEND_ID'
}
});
}
const result = await FriendService.acceptFriendRequest(userId, friendId); const result = await FriendService.acceptFriendRequest(userId, friendId);
return res.status(200).json({ return res.status(200).json({
success: true, success: true,
...@@ -107,6 +127,7 @@ class friendController { ...@@ -107,6 +127,7 @@ class friendController {
}); });
}); });
} catch (error) { } catch (error) {
console.error('Friend request accept error:', error);
return res.status(400).json({ return res.status(400).json({
success: false, success: false,
error: { error: {
......
...@@ -27,11 +27,22 @@ class ScheduleService { ...@@ -27,11 +27,22 @@ class ScheduleService {
const scheduleData = time_indices.map(time_idx => ({ const scheduleData = time_indices.map(time_idx => ({
user_id: userId, user_id: userId,
title, title,
time_idx, time_idx: parseInt(time_idx, 10),
is_fixed is_fixed
})); }));
try { try {
if (!userId || !title || !time_indices) {
throw new Error('Required parameters missing');
}
console.log('Creating schedule with data:', {
userId,
title,
is_fixed,
time_indices
});
const createdSchedules = await Schedule.bulkCreate(scheduleData, { const createdSchedules = await Schedule.bulkCreate(scheduleData, {
transaction, transaction,
returning: true, returning: true,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment