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:
2026-01-28 17:12:40 -05:00
parent c76f745df7
commit 935b867219
50 changed files with 982 additions and 23 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 593 KiB

@@ -0,0 +1,28 @@
<?xml version='1.0' encoding='utf-8'?>
<package xmlns="http://www.idpf.org/2007/opf" unique-identifier="uuid_id" version="2.0">
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf">
<dc:identifier opf:scheme="calibre" id="calibre_id">1260</dc:identifier>
<dc:identifier opf:scheme="uuid" id="uuid_id">e6b66a29-3198-4358-82b5-2c031277975d</dc:identifier>
<dc:title>Haley and the Catfish Invasion</dc:title>
<dc:creator opf:file-as="Hogarth, Maggie" opf:role="aut">Maggie Hogarth</dc:creator>
<dc:contributor opf:file-as="calibre" opf:role="bkp">calibre (8.16.2) [https://calibre-ebook.com]</dc:contributor>
<dc:date>2022-09-29T04:00:00+00:00</dc:date>
<dc:description>&lt;div&gt;
&lt;p&gt;Haley and Nana return in a second heartwarming adventure! Having embraced her new meta class, Haley is ready for anything... except, possibly, a plague of seafood! It turns out it's harder than she thought to sit back and let other people handle the problems she really, really wants solved.... &lt;/p&gt;
&lt;p&gt;This second installment in the adventures of a post-apocalyptic world with a game system imposed on it by magical aliens contains yet another recipe, because (once again), that's the kind of story this is. Curl up with some cornbread and watch Haley craft her way through another quick read!&lt;/p&gt;&lt;/div&gt;</dc:description>
<dc:publisher>Independently published</dc:publisher>
<dc:identifier opf:scheme="MOBI-ASIN">B0BF28JZY8</dc:identifier>
<dc:identifier opf:scheme="ISBN">9798352753477</dc:identifier>
<dc:identifier opf:scheme="GOODREADS">63207700</dc:identifier>
<dc:language>eng</dc:language>
<dc:subject>Fantasy</dc:subject>
<meta name="calibre:series" content="Haley and Nana"/>
<meta name="calibre:series_index" content="2"/>
<meta name="calibre:rating" content="8"/>
<meta name="calibre:timestamp" content="2026-01-07T15:57:10.861295+00:00"/>
<meta name="calibre:title_sort" content="Haley and the Catfish Invasion"/>
</metadata>
<guide>
<reference type="cover" title="Cover" href="cover.jpg"/>
</guide>
</package>
Binary file not shown.

After

Width:  |  Height:  |  Size: 982 KiB

@@ -0,0 +1,29 @@
<?xml version='1.0' encoding='utf-8'?>
<package xmlns="http://www.idpf.org/2007/opf" unique-identifier="uuid_id" version="2.0">
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf">
<dc:identifier opf:scheme="calibre" id="calibre_id">1265</dc:identifier>
<dc:identifier opf:scheme="uuid" id="uuid_id">e633d246-279d-4e29-940a-6b9188845795</dc:identifier>
<dc:title>Haley and the Spooky Dungeon</dc:title>
<dc:creator opf:file-as="Hogarth, Maggie" opf:role="aut">Maggie Hogarth</dc:creator>
<dc:contributor opf:file-as="calibre" opf:role="bkp">calibre (8.16.2) [https://calibre-ebook.com]</dc:contributor>
<dc:date>2022-10-25T04:00:00+00:00</dc:date>
<dc:description>&lt;div&gt;
&lt;p style="font-weight: bold"&gt;A Girl, a Great-Grandma, and a Dungeon! &lt;/p&gt;
&lt;p&gt;Having found the town of Refuge a trainer, Haley is tasked with the system's newest quest: to set up a starter dungeon for her local adventurers in time for Halloween! Haleys not sure shes the girl for this task, since shes not into creepy things. Fortunately, she has some unexpected (and enthusiastic) help, and of course, guidance from Nana... and maybe by the end, she begins to see things in a different (and creepier!) light. &lt;/p&gt;
&lt;p&gt;Join Haley for this third installment in the adventures of a post-apocalyptic world with a game system imposed on it by magical aliens. It contains yet another recipe, because (once again), that's the kind of story this is. Break out your pans and make some pumpkin bread and then watch Haley design her way through another quick read!&lt;/p&gt;&lt;/div&gt;</dc:description>
<dc:publisher>Independently published</dc:publisher>
<dc:identifier opf:scheme="MOBI-ASIN">B0BHGSP8RZ</dc:identifier>
<dc:identifier opf:scheme="ISBN">9798357047915</dc:identifier>
<dc:identifier opf:scheme="GOODREADS">63207696</dc:identifier>
<dc:language>eng</dc:language>
<dc:subject>Fantasy</dc:subject>
<meta name="calibre:series" content="Haley and Nana"/>
<meta name="calibre:series_index" content="3"/>
<meta name="calibre:rating" content="8"/>
<meta name="calibre:timestamp" content="2026-01-07T15:57:13.749982+00:00"/>
<meta name="calibre:title_sort" content="Haley and the Spooky Dungeon"/>
</metadata>
<guide>
<reference type="cover" title="Cover" href="cover.jpg"/>
</guide>
</package>