컨트롤러 수정

This commit is contained in:
dohyeons 2025-10-01 11:45:17 +09:00
parent 93e5331d6c
commit 21caac8c63
1 changed files with 22 additions and 23 deletions

View File

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