The WIP GET /api/filler-presets, /api/watermarks, and /api/graphics-elements endpoints omitted the Name= route attribute used by the other API GET actions (e.g. FFmpegProfileController). Add Name = "GetFillerPresets" / "GetWatermarks" / "GetGraphicsElements" for consistency. Also add handler tests (FillerPresetHandlerTests, WatermarkHandlerTests, GraphicsElementHandlerTests) covering the GetAll*ForApi handlers using the InMemoryTvContext harness: multi-row projection to (Id, Name) DTOs, the empty-DB case, and the graphics-element ordering rule (named elements sort before elements whose projected Name equals FileName).
20 lines
758 B
C#
20 lines
758 B
C#
using ErsatzTV.Application.Graphics;
|
|
using ErsatzTV.Core.Api.Graphics;
|
|
using MediatR;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace ErsatzTV.Controllers.Api;
|
|
|
|
[ApiController]
|
|
public class GraphicsElementController(IMediator mediator) : ControllerBase
|
|
{
|
|
[HttpGet("/api/graphics-elements", Name = "GetGraphicsElements")]
|
|
[Tags("Graphics Elements")]
|
|
[EndpointSummary("Get all graphics elements")]
|
|
[EndpointGroupName("general")]
|
|
[ProducesResponseType(typeof(List<GraphicsElementResponseModel>), StatusCodes.Status200OK)]
|
|
public async Task<List<GraphicsElementResponseModel>> GetAll(CancellationToken cancellationToken) =>
|
|
await mediator.Send(new GetAllGraphicsElementsForApi(), cancellationToken);
|
|
}
|