- Add Microsoft.Data.Sqlite NuGet package to csproj - Create Lesson model (Id, Title, Grade, Subject, LessonDate, Description, SourcePath, CompiledHtml, CreatedAt, UpdatedAt) - Create LessonMedia model (LessonId, JellyfinItemId, SortOrder) - Create LessonStore with SQLite-backed CRUD operations: - Constructor expands ~ in dbPath to home directory - Creates lessons and lesson_media tables on init - GetAllLessons(), GetLessonById(), GetLessonsByGrade() - UpsertLesson() with media association handling - DeleteLesson() with FK cascade - Enables foreign key enforcement via PRAGMA - Build passes with 0 warnings, 0 errors Closes #4
65 lines
No EOL
1.6 KiB
C#
65 lines
No EOL
1.6 KiB
C#
#nullable enable
|
|
using System.Collections.Generic;
|
|
|
|
namespace JellyfinLessons.Data.Models;
|
|
|
|
/// <summary>
|
|
/// Represents a homeschool lesson plan.
|
|
/// </summary>
|
|
public class Lesson
|
|
{
|
|
/// <summary>
|
|
/// Unique identifier (Guid).
|
|
/// </summary>
|
|
public string Id { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// Lesson title.
|
|
/// </summary>
|
|
public string Title { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// Target grade level.
|
|
/// </summary>
|
|
public int Grade { get; set; }
|
|
|
|
/// <summary>
|
|
/// Subject area (e.g. Math, Science, History).
|
|
/// </summary>
|
|
public string Subject { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// Date the lesson covers (ISO 8601 format).
|
|
/// </summary>
|
|
public string LessonDate { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// Optional description of the lesson.
|
|
/// </summary>
|
|
public string? Description { get; set; }
|
|
|
|
/// <summary>
|
|
/// Path to the source markdown or plan file.
|
|
/// </summary>
|
|
public string SourcePath { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// Pre-compiled HTML rendering of the lesson.
|
|
/// </summary>
|
|
public string? CompiledHtml { get; set; }
|
|
|
|
/// <summary>
|
|
/// ISO 8601 creation timestamp.
|
|
/// </summary>
|
|
public string CreatedAt { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// ISO 8601 last-updated timestamp.
|
|
/// </summary>
|
|
public string UpdatedAt { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// Associated media items (lazy-loaded).
|
|
/// </summary>
|
|
public List<LessonMedia> MediaItems { get; set; } = new();
|
|
} |