fix: 캘린더 모달 중복 카드 문제 및 삭제 권한 개선
- monthly_worker_status 조회 시 GROUP BY로 중복 데이터 합산 - 작업보고서 삭제 권한을 그룹장 이상으로 제한 (admin, system, group_leader) - 중복 데이터 정리를 위한 마이그레이션 SQL 추가 (009_fix_duplicate_monthly_status.sql) - synology_deployment 버전에도 동일 수정 적용
This commit is contained in:
228
synology_deployment/api/routes/workerRoutes.js
Normal file
228
synology_deployment/api/routes/workerRoutes.js
Normal file
@@ -0,0 +1,228 @@
|
||||
/**
|
||||
* @swagger
|
||||
* tags:
|
||||
* name: Workers
|
||||
* description: 작업자 관리 API
|
||||
*/
|
||||
|
||||
const express = require('express');
|
||||
const router = express.Router();
|
||||
const workerController = require('../controllers/workerController');
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/workers:
|
||||
* post:
|
||||
* tags: [Workers]
|
||||
* summary: 작업자 생성
|
||||
* description: 새로운 작업자를 생성합니다.
|
||||
* security:
|
||||
* - bearerAuth: []
|
||||
* requestBody:
|
||||
* required: true
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - worker_name
|
||||
* properties:
|
||||
* worker_name:
|
||||
* type: string
|
||||
* example: "김철수"
|
||||
* position:
|
||||
* type: string
|
||||
* example: "용접공"
|
||||
* department:
|
||||
* type: string
|
||||
* example: "생산부"
|
||||
* phone:
|
||||
* type: string
|
||||
* example: "010-1234-5678"
|
||||
* email:
|
||||
* type: string
|
||||
* format: email
|
||||
* example: "worker@technicalkorea.com"
|
||||
* responses:
|
||||
* 201:
|
||||
* description: 작업자 생성 성공
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/components/schemas/SuccessResponse'
|
||||
* 400:
|
||||
* description: 잘못된 요청
|
||||
* 401:
|
||||
* description: 인증 필요
|
||||
* 500:
|
||||
* description: 서버 오류
|
||||
* get:
|
||||
* tags: [Workers]
|
||||
* summary: 전체 작업자 조회
|
||||
* description: 모든 작업자 목록을 조회합니다.
|
||||
* security:
|
||||
* - bearerAuth: []
|
||||
* responses:
|
||||
* 200:
|
||||
* description: 작업자 목록 조회 성공
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* success:
|
||||
* type: boolean
|
||||
* example: true
|
||||
* message:
|
||||
* type: string
|
||||
* example: "작업자 목록 조회 성공"
|
||||
* data:
|
||||
* type: array
|
||||
* items:
|
||||
* $ref: '#/components/schemas/Worker'
|
||||
* meta:
|
||||
* type: object
|
||||
* properties:
|
||||
* count:
|
||||
* type: integer
|
||||
* example: 10
|
||||
* 401:
|
||||
* description: 인증 필요
|
||||
* 500:
|
||||
* description: 서버 오류
|
||||
*/
|
||||
router.post('/', workerController.createWorker);
|
||||
router.get('/', workerController.getAllWorkers);
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/workers/{worker_id}:
|
||||
* get:
|
||||
* tags: [Workers]
|
||||
* summary: 특정 작업자 조회
|
||||
* description: ID로 특정 작업자 정보를 조회합니다.
|
||||
* security:
|
||||
* - bearerAuth: []
|
||||
* parameters:
|
||||
* - in: path
|
||||
* name: worker_id
|
||||
* required: true
|
||||
* schema:
|
||||
* type: integer
|
||||
* description: 작업자 ID
|
||||
* responses:
|
||||
* 200:
|
||||
* description: 작업자 조회 성공
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* success:
|
||||
* type: boolean
|
||||
* example: true
|
||||
* message:
|
||||
* type: string
|
||||
* example: "작업자 조회 성공"
|
||||
* data:
|
||||
* $ref: '#/components/schemas/Worker'
|
||||
* 400:
|
||||
* description: 잘못된 작업자 ID
|
||||
* 401:
|
||||
* description: 인증 필요
|
||||
* 404:
|
||||
* description: 작업자를 찾을 수 없음
|
||||
* 500:
|
||||
* description: 서버 오류
|
||||
* put:
|
||||
* tags: [Workers]
|
||||
* summary: 작업자 정보 수정
|
||||
* description: 작업자 정보를 수정합니다.
|
||||
* security:
|
||||
* - bearerAuth: []
|
||||
* parameters:
|
||||
* - in: path
|
||||
* name: worker_id
|
||||
* required: true
|
||||
* schema:
|
||||
* type: integer
|
||||
* description: 작업자 ID
|
||||
* requestBody:
|
||||
* required: true
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* worker_name:
|
||||
* type: string
|
||||
* example: "김철수"
|
||||
* position:
|
||||
* type: string
|
||||
* example: "용접공"
|
||||
* department:
|
||||
* type: string
|
||||
* example: "생산부"
|
||||
* phone:
|
||||
* type: string
|
||||
* example: "010-1234-5678"
|
||||
* email:
|
||||
* type: string
|
||||
* format: email
|
||||
* example: "worker@technicalkorea.com"
|
||||
* responses:
|
||||
* 200:
|
||||
* description: 작업자 수정 성공
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/components/schemas/SuccessResponse'
|
||||
* 400:
|
||||
* description: 잘못된 요청
|
||||
* 401:
|
||||
* description: 인증 필요
|
||||
* 404:
|
||||
* description: 작업자를 찾을 수 없음
|
||||
* 500:
|
||||
* description: 서버 오류
|
||||
* delete:
|
||||
* tags: [Workers]
|
||||
* summary: 작업자 삭제
|
||||
* description: 작업자를 삭제합니다.
|
||||
* security:
|
||||
* - bearerAuth: []
|
||||
* parameters:
|
||||
* - in: path
|
||||
* name: worker_id
|
||||
* required: true
|
||||
* schema:
|
||||
* type: integer
|
||||
* description: 작업자 ID
|
||||
* responses:
|
||||
* 200:
|
||||
* description: 작업자 삭제 성공
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* success:
|
||||
* type: boolean
|
||||
* example: true
|
||||
* message:
|
||||
* type: string
|
||||
* example: "작업자가 성공적으로 삭제되었습니다."
|
||||
* 400:
|
||||
* description: 잘못된 작업자 ID
|
||||
* 401:
|
||||
* description: 인증 필요
|
||||
* 404:
|
||||
* description: 작업자를 찾을 수 없음
|
||||
* 500:
|
||||
* description: 서버 오류
|
||||
*/
|
||||
router.get('/:worker_id', workerController.getWorkerById);
|
||||
router.put('/:worker_id', workerController.updateWorker);
|
||||
router.delete('/:worker_id', workerController.removeWorker);
|
||||
|
||||
module.exports = router;
|
||||
Reference in New Issue
Block a user