Task A (#126): new non-polymorphic ScheduleItemResponseModel / ScheduleItemsResponseModel in Core/Api/Scheduling, plus shared NamedIdResponseModel. ScheduleItemResponseMapper flattens the One/Flood/Multiple/Duration VM hierarchy. ScheduleController GET/POST/PUT items now return the flat DTOs. Task B: GET /api/languages (LanguagesController + LanguageCodeResponseModel); GET /api/channels/music-video-credits-templates and GET /api/channels/stream-selectors; FillerKind added to FillerPresetResponseModel with optional ?fillerKind= filter on GET /api/filler-presets. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
26 lines
948 B
C#
26 lines
948 B
C#
using System.Linq;
|
|
using ErsatzTV.Application.MediaItems;
|
|
using ErsatzTV.Core.Api.MediaItems;
|
|
using MediatR;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace ErsatzTV.Controllers.Api;
|
|
|
|
[ApiController]
|
|
public class LanguagesController(IMediator mediator) : ControllerBase
|
|
{
|
|
[HttpGet("/api/languages", Name = "GetLanguages")]
|
|
[Tags("Languages")]
|
|
[EndpointSummary("Get all available language codes")]
|
|
[EndpointGroupName("general")]
|
|
[ProducesResponseType(typeof(List<LanguageCodeResponseModel>), StatusCodes.Status200OK)]
|
|
public async Task<List<LanguageCodeResponseModel>> GetLanguages(CancellationToken cancellationToken)
|
|
{
|
|
List<LanguageCodeViewModel> languages = await mediator.Send(new GetAllLanguageCodes(), cancellationToken);
|
|
return languages
|
|
.Select(l => new LanguageCodeResponseModel(l.ThreeLetterISOLanguageName, l.EnglishName))
|
|
.ToList();
|
|
}
|
|
}
|