Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | /** * 작업 보고서 관리 컨트롤러 * * 작업 보고서 CRUD API 엔드포인트 핸들러 * * @author TK-FB-Project * @since 2025-12-11 */ const workReportService = require('../services/workReportService'); const { asyncHandler } = require('../middlewares/errorHandler'); /** * 작업 보고서 생성 (단일 또는 다중) */ exports.createWorkReport = asyncHandler(async (req, res) => { const result = await workReportService.createWorkReportService(req.body); res.json({ success: true, data: result, message: '작업 보고서가 성공적으로 생성되었습니다' }); }); /** * 날짜별 작업 보고서 조회 */ exports.getWorkReportsByDate = asyncHandler(async (req, res) => { const { date } = req.params; const rows = await workReportService.getWorkReportsByDateService(date); res.json({ success: true, data: rows, message: '작업 보고서 조회 성공' }); }); /** * 기간별 작업 보고서 조회 */ exports.getWorkReportsInRange = asyncHandler(async (req, res) => { const { start, end } = req.query; const rows = await workReportService.getWorkReportsInRangeService(start, end); res.json({ success: true, data: rows, message: '작업 보고서 조회 성공' }); }); /** * 단일 작업 보고서 조회 */ exports.getWorkReportById = asyncHandler(async (req, res) => { const { id } = req.params; const row = await workReportService.getWorkReportByIdService(id); res.json({ success: true, data: row, message: '작업 보고서 조회 성공' }); }); /** * 작업 보고서 수정 */ exports.updateWorkReport = asyncHandler(async (req, res) => { const { id } = req.params; const result = await workReportService.updateWorkReportService(id, req.body); res.json({ success: true, data: result, message: '작업 보고서가 성공적으로 수정되었습니다' }); }); /** * 작업 보고서 삭제 */ exports.removeWorkReport = asyncHandler(async (req, res) => { const { id } = req.params; const result = await workReportService.removeWorkReportService(id); res.json({ success: true, data: result, message: '작업 보고서가 성공적으로 삭제되었습니다' }); }); /** * 월간 요약 조회 */ exports.getSummary = asyncHandler(async (req, res) => { const { year, month } = req.query; const rows = await workReportService.getSummaryService(year, month); res.json({ success: true, data: rows, message: '월간 요약 조회 성공' }); }); |