작업계획서대로 진행

This commit is contained in:
2026-01-11 01:29:46 +09:00
parent 1b8cd8577e
commit 01bd66d524
51 changed files with 11124 additions and 273 deletions

View File

@@ -0,0 +1,30 @@
import { execute, queryOne } from '../../../utils/db'
/**
* 사업 주간보고 확정
* PUT /api/business-report/[id]/confirm
*/
export default defineEventHandler(async (event) => {
const businessReportId = Number(getRouterParam(event, 'id'))
const existing = await queryOne(`
SELECT * FROM wr_business_weekly_report WHERE business_report_id = $1
`, [businessReportId])
if (!existing) {
throw createError({ statusCode: 404, message: '보고서를 찾을 수 없습니다.' })
}
if (existing.status === 'confirmed') {
throw createError({ statusCode: 400, message: '이미 확정된 보고서입니다.' })
}
await execute(`
UPDATE wr_business_weekly_report SET
status = 'confirmed',
updated_at = NOW()
WHERE business_report_id = $1
`, [businessReportId])
return { success: true, message: '보고서가 확정되었습니다.' }
})