feat: 알림 시스템 및 시설설비 관리 기능 구현
- 알림 시스템 구축 (navbar 알림 아이콘, 드롭다운) - 알림 수신자 설정 기능 (계정관리 페이지) - 시설설비 관리 페이지 추가 (수리 워크플로우) - 수리 신청 → 접수 → 처리중 → 완료 상태 관리 - 사이드바 메뉴 구조 개선 (공장 관리 카테고리) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
-- 알림 수신자 설정 테이블
|
||||
-- 알림 유형별로 지정된 사용자에게만 알림이 전송됨
|
||||
|
||||
CREATE TABLE IF NOT EXISTS notification_recipients (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
notification_type ENUM('repair', 'safety', 'nonconformity', 'equipment', 'maintenance', 'system') NOT NULL COMMENT '알림 유형',
|
||||
user_id INT NOT NULL COMMENT '수신자 ID',
|
||||
is_active BOOLEAN DEFAULT TRUE COMMENT '활성 여부',
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
created_by INT NULL COMMENT '등록자',
|
||||
UNIQUE KEY unique_type_user (notification_type, user_id),
|
||||
FOREIGN KEY (user_id) REFERENCES users(user_id) ON DELETE CASCADE,
|
||||
INDEX idx_nr_type (notification_type),
|
||||
INDEX idx_nr_active (is_active)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='알림 수신자 설정';
|
||||
|
||||
-- 알림 유형 설명:
|
||||
-- repair: 설비 수리 신청
|
||||
-- safety: 안전 신고
|
||||
-- nonconformity: 부적합 신고
|
||||
-- equipment: 설비 관련
|
||||
-- maintenance: 정기점검
|
||||
-- system: 시스템 알림
|
||||
@@ -0,0 +1,46 @@
|
||||
-- 알림 시스템 테이블 생성
|
||||
-- 실행: docker exec -i tkfb_db mysql -u hyungi -p'your_password' hyungi < db/migrations/20260205004000_create_notifications.sql
|
||||
|
||||
-- ============================================
|
||||
-- STEP 1: notifications 테이블 생성
|
||||
-- ============================================
|
||||
|
||||
CREATE TABLE IF NOT EXISTS notifications (
|
||||
notification_id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
user_id INT NULL COMMENT '특정 사용자에게만 표시 (NULL이면 전체)',
|
||||
type ENUM('repair', 'safety', 'system', 'equipment', 'maintenance') NOT NULL DEFAULT 'system',
|
||||
title VARCHAR(200) NOT NULL,
|
||||
message TEXT,
|
||||
link_url VARCHAR(500) COMMENT '클릭시 이동할 URL',
|
||||
reference_type VARCHAR(50) COMMENT '연관 테이블 (equipment_repair_requests 등)',
|
||||
reference_id INT COMMENT '연관 레코드 ID',
|
||||
is_read BOOLEAN DEFAULT FALSE,
|
||||
read_at DATETIME NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
created_by INT NULL,
|
||||
INDEX idx_notifications_user (user_id),
|
||||
INDEX idx_notifications_type (type),
|
||||
INDEX idx_notifications_is_read (is_read),
|
||||
INDEX idx_notifications_created (created_at DESC)
|
||||
);
|
||||
|
||||
-- 수리 요청 테이블 수정 (알림 연동을 위해)
|
||||
-- equipment_repair_requests 테이블이 없으면 생성
|
||||
CREATE TABLE IF NOT EXISTS equipment_repair_requests (
|
||||
request_id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
equipment_id INT UNSIGNED NOT NULL,
|
||||
repair_type VARCHAR(100) NOT NULL,
|
||||
description TEXT,
|
||||
urgency ENUM('low', 'normal', 'high', 'urgent') DEFAULT 'normal',
|
||||
status ENUM('pending', 'in_progress', 'completed', 'cancelled') DEFAULT 'pending',
|
||||
requested_by INT,
|
||||
assigned_to INT NULL,
|
||||
completed_at DATETIME NULL,
|
||||
notes TEXT,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (equipment_id) REFERENCES equipments(equipment_id) ON DELETE CASCADE,
|
||||
INDEX idx_err_equipment (equipment_id),
|
||||
INDEX idx_err_status (status),
|
||||
INDEX idx_err_created (created_at DESC)
|
||||
);
|
||||
Reference in New Issue
Block a user