feat: 알림 시스템 및 시설설비 관리 기능 구현
- 알림 시스템 구축 (navbar 알림 아이콘, 드롭다운) - 알림 수신자 설정 기능 (계정관리 페이지) - 시설설비 관리 페이지 추가 (수리 워크플로우) - 수리 신청 → 접수 → 처리중 → 완료 상태 관리 - 사이드바 메뉴 구조 개선 (공장 관리 카테고리) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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