feat: SQLite data store with Lesson/LessonMedia models and LessonStore #12

Closed
agent-engineering wants to merge 1 commit from agent-engineering/jellyfin-lessons:issue-4-data-store into main
Contributor

Summary

Implements issue #4 — SQLite lesson data store.

Changes

  • csproj: Added Microsoft.Data.Sqlite 9.0.* with ExcludeAssets=runtime
  • Lesson.cs: Model with Id, Title, Grade, Subject, LessonDate, Description, SourcePath, CompiledHtml, CreatedAt, UpdatedAt + MediaItems nav property
  • LessonMedia.cs: Join model with LessonId, JellyfinItemId, SortOrder
  • LessonStore.cs: SQLite-backed CRUD store
    • Constructor expands ~ in dbPath to home directory
    • Creates lessons and lesson_media tables on init (CREATE TABLE IF NOT EXISTS)
    • Enables foreign key enforcement via PRAGMA
    • Methods: GetAllLessons(), GetLessonById(string), GetLessonsByGrade(int), UpsertLesson(Lesson, List<LessonMedia>), DeleteLesson(string)
    • UpsertLesson uses INSERT ... ON CONFLICT DO UPDATE and replaces media entries in a transaction

Build

dotnet build passes with 0 errors, 0 warnings.

Closes #4

## Summary Implements issue #4 — SQLite lesson data store. ### Changes - **csproj**: Added `Microsoft.Data.Sqlite` 9.0.* with `ExcludeAssets=runtime` - **Lesson.cs**: Model with Id, Title, Grade, Subject, LessonDate, Description, SourcePath, CompiledHtml, CreatedAt, UpdatedAt + MediaItems nav property - **LessonMedia.cs**: Join model with LessonId, JellyfinItemId, SortOrder - **LessonStore.cs**: SQLite-backed CRUD store - Constructor expands `~` in dbPath to home directory - Creates `lessons` and `lesson_media` tables on init (CREATE TABLE IF NOT EXISTS) - Enables foreign key enforcement via PRAGMA - Methods: `GetAllLessons()`, `GetLessonById(string)`, `GetLessonsByGrade(int)`, `UpsertLesson(Lesson, List<LessonMedia>)`, `DeleteLesson(string)` - UpsertLesson uses INSERT ... ON CONFLICT DO UPDATE and replaces media entries in a transaction ### Build `dotnet build` passes with 0 errors, 0 warnings. Closes #4
Owner

Verified: SQLite data store (Lesson.cs, LessonMedia.cs, LessonStore.cs) was implemented. Build passes. Closing.

Verified: SQLite data store (Lesson.cs, LessonMedia.cs, LessonStore.cs) was implemented. Build passes. Closing.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: sscoble/jellyfin-lessons#12
No description provided.