diff --git a/backend-node/src/controllers/reportController.ts b/backend-node/src/controllers/reportController.ts index 6a12df95..02d79030 100644 --- a/backend-node/src/controllers/reportController.ts +++ b/backend-node/src/controllers/reportController.ts @@ -38,12 +38,12 @@ export class ReportController { sortOrder: sortOrder as "ASC" | "DESC", }); - res.json({ + return res.json({ success: true, data: result, }); } catch (error) { - next(error); + return next(error); } } @@ -64,12 +64,12 @@ export class ReportController { }); } - res.json({ + return res.json({ success: true, data: report, }); } catch (error) { - next(error); + return next(error); } } @@ -92,7 +92,7 @@ export class ReportController { const reportId = await reportService.createReport(data, userId); - res.status(201).json({ + return res.status(201).json({ success: true, data: { reportId, @@ -100,7 +100,7 @@ export class ReportController { message: "리포트가 생성되었습니다.", }); } catch (error) { - next(error); + return next(error); } } @@ -123,12 +123,12 @@ export class ReportController { }); } - res.json({ + return res.json({ success: true, message: "리포트가 수정되었습니다.", }); } catch (error) { - next(error); + return next(error); } } @@ -149,12 +149,12 @@ export class ReportController { }); } - res.json({ + return res.json({ success: true, message: "리포트가 삭제되었습니다.", }); } catch (error) { - next(error); + return next(error); } } @@ -176,7 +176,7 @@ export class ReportController { }); } - res.status(201).json({ + return res.status(201).json({ success: true, data: { reportId: newReportId, @@ -184,7 +184,7 @@ export class ReportController { message: "리포트가 복사되었습니다.", }); } catch (error) { - next(error); + return next(error); } } @@ -211,12 +211,12 @@ export class ReportController { components: layout.components ? JSON.parse(layout.components) : [], }; - res.json({ + return res.json({ success: true, data: layoutData, }); } catch (error) { - next(error); + return next(error); } } @@ -245,12 +245,12 @@ export class ReportController { await reportService.saveLayout(reportId, data, userId); - res.json({ + return res.json({ success: true, message: "레이아웃이 저장되었습니다.", }); } catch (error) { - next(error); + return next(error); } } @@ -262,12 +262,12 @@ export class ReportController { try { const templates = await reportService.getTemplates(); - res.json({ + return res.json({ success: true, data: templates, }); } catch (error) { - next(error); + return next(error); } } @@ -290,7 +290,7 @@ export class ReportController { const templateId = await reportService.createTemplate(data, userId); - res.status(201).json({ + return res.status(201).json({ success: true, data: { templateId, @@ -298,7 +298,7 @@ export class ReportController { message: "템플릿이 생성되었습니다.", }); } catch (error) { - next(error); + return next(error); } } @@ -319,15 +319,14 @@ export class ReportController { }); } - res.json({ + return res.json({ success: true, message: "템플릿이 삭제되었습니다.", }); } catch (error) { - next(error); + return next(error); } } } export default new ReportController(); -