- Add LessonsController with GET /Plugins/Lessons/List endpoint - Add LessonStore DI registration in ServiceRegistrator - Add lessonsPage.html embedded resource with grouped lesson listing - Implement IHasWebPages in Plugin for sidebar nav entry - Add ImplicitUsings/Nullable to csproj for net9.0 compatibility - Add Microsoft.AspNetCore.App FrameworkReference for MVC - Fix ServiceRegistrator to match 10.10.x IPluginServiceRegistrator signature
34 lines
738 B
C#
34 lines
738 B
C#
using Microsoft.AspNetCore.Mvc;
|
|
using Jellyfin.Plugin.Lessons.Data;
|
|
|
|
namespace Jellyfin.Plugin.Lessons.Api;
|
|
|
|
[ApiController]
|
|
[Route("Plugins/Lessons")]
|
|
public class LessonsController : ControllerBase
|
|
{
|
|
private readonly LessonStore _store;
|
|
|
|
public LessonsController(LessonStore store)
|
|
{
|
|
_store = store;
|
|
}
|
|
|
|
[HttpGet("List")]
|
|
public IActionResult List()
|
|
{
|
|
var lessons = _store.GetAllLessons();
|
|
|
|
var summaries = lessons.Select(l => new
|
|
{
|
|
id = l.Id,
|
|
title = l.Title,
|
|
grade = l.Grade,
|
|
subject = l.Subject,
|
|
lessonDate = l.LessonDate,
|
|
description = l.Description
|
|
});
|
|
|
|
return Ok(summaries);
|
|
}
|
|
}
|