Files
TK-FB-Project/deploy/tkfb-package/api.hyungi.net/controllers/toolsController.js
Hyungi Ahn 2b1c7bfb88 feat: 다수 기능 개선 - 순찰, 출근, 작업분석, 모바일 UI 등
- 순찰/점검 기능 개선 (zone-detail 페이지 추가)
- 출근/근태 시스템 개선 (연차 조회, 근무현황)
- 작업분석 대분류 그룹화 및 마이그레이션 스크립트
- 모바일 네비게이션 UI 추가
- NAS 배포 도구 및 문서 추가

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 14:41:01 +09:00

76 lines
1.6 KiB
JavaScript

/**
* 도구 관리 컨트롤러
*
* 도구(공구) 재고 및 위치 관리 API 엔드포인트 핸들러
*
* @author TK-FB-Project
* @since 2025-12-11
*/
const toolsService = require('../services/toolsService');
const { asyncHandler } = require('../middlewares/errorHandler');
/**
* 전체 도구 조회
*/
exports.getAll = asyncHandler(async (req, res) => {
const rows = await toolsService.getAllToolsService();
res.json({
success: true,
data: rows,
message: '도구 목록 조회 성공'
});
});
/**
* 단일 도구 조회
*/
exports.getById = asyncHandler(async (req, res) => {
const id = parseInt(req.params.id, 10);
const row = await toolsService.getToolByIdService(id);
res.json({
success: true,
data: row,
message: '도구 조회 성공'
});
});
/**
* 도구 생성
*/
exports.create = asyncHandler(async (req, res) => {
const result = await toolsService.createToolService(req.body);
res.status(201).json({
success: true,
data: result,
message: '도구가 성공적으로 생성되었습니다'
});
});
/**
* 도구 수정
*/
exports.update = asyncHandler(async (req, res) => {
const id = parseInt(req.params.id, 10);
const result = await toolsService.updateToolService(id, req.body);
res.json({
success: true,
data: result,
message: '도구 정보가 성공적으로 수정되었습니다'
});
});
/**
* 도구 삭제
*/
exports.delete = asyncHandler(async (req, res) => {
const id = parseInt(req.params.id, 10);
await toolsService.deleteToolService(id);
res.status(204).send();
});