feat: add highlights and notes annotation system
This major update implements a complete user annotation system: ## 🎯 New Features - User notes with position tracking for media items - Text highlighting with customizable colors - Highlight-note associations for detailed annotations - Full CRUD API for both notes and highlights - Backward compatibility with existing ebook endpoints ## 📊 Database Changes - Add media_notes table (id, media_item_id, user_id, content, position, timestamps) - Add media_highlights table (id, media_item_id, user_id, selection_text, start/end_position, color, optional note_id) - Add foreign key relationships with CASCADE deletes - Add proper indexes for performance - Add database schema views for ebook backward compatibility ## 🔧 API Implementation - Complete REST API endpoints for notes and highlights - JWT authentication with proper middleware bypass - Request validation with meaningful error responses - UUID validation and type safety - Support for hex color codes in highlights ## 🧪 Testing & Documentation - Comprehensive test suite covering authentication scenarios - Bruno API collection for manual testing - Detailed testing guide with troubleshooting - Updated documentation in README and TESTING.md ## 📁 Backward Compatibility - Existing ebook endpoints continue working - Database views maintain API contracts - No breaking changes for existing integrations The annotation system is now fully functional and ready for production use.
This commit is contained in:
+16
-16
@@ -16,6 +16,22 @@ INSERT INTO library_types (name, description, allowed_extensions) VALUES
|
||||
('comics', 'Comic book archives and image formats', ARRAY['.cbz', '.cbr', '.cb7', '.cbt', '.pdf']),
|
||||
('manga', 'Manga files including archives and image folders', ARRAY['.cbz', '.cbr', '.png', '.jpg', '.jpeg', '.gif', '.bmp', '.webp']);
|
||||
|
||||
-- Create users table
|
||||
CREATE TABLE users (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
email VARCHAR(255) UNIQUE NOT NULL,
|
||||
username VARCHAR(255) UNIQUE NOT NULL,
|
||||
password_hash VARCHAR(255) NOT NULL,
|
||||
first_name VARCHAR(255),
|
||||
last_name VARCHAR(255),
|
||||
role VARCHAR(20) NOT NULL DEFAULT 'user' CHECK (role IN ('admin', 'user')),
|
||||
theme VARCHAR(50) DEFAULT 'tokyo-night',
|
||||
scan_frequency_minutes INTEGER DEFAULT 60,
|
||||
auto_scan_enabled BOOLEAN DEFAULT true,
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
|
||||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
|
||||
);
|
||||
|
||||
-- Create libraries table
|
||||
CREATE TABLE libraries (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
@@ -47,22 +63,6 @@ CREATE TABLE library_visibility (
|
||||
UNIQUE(user_id, library_id)
|
||||
);
|
||||
|
||||
-- Create users table
|
||||
CREATE TABLE users (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
email VARCHAR(255) UNIQUE NOT NULL,
|
||||
username VARCHAR(255) UNIQUE NOT NULL,
|
||||
password_hash VARCHAR(255) NOT NULL,
|
||||
first_name VARCHAR(255),
|
||||
last_name VARCHAR(255),
|
||||
role VARCHAR(20) NOT NULL DEFAULT 'user' CHECK (role IN ('admin', 'user')),
|
||||
theme VARCHAR(50) DEFAULT 'tokyo-night',
|
||||
scan_frequency_minutes INTEGER DEFAULT 60,
|
||||
auto_scan_enabled BOOLEAN DEFAULT true,
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
|
||||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
|
||||
);
|
||||
|
||||
-- Create media_items table (replaces ebooks table for broader media support)
|
||||
CREATE TABLE media_items (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
|
||||
Reference in New Issue
Block a user