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
711 B
C#
20 lines
711 B
C#
using ErsatzTV.Application.Watermarks;
|
|
using ErsatzTV.Core.Api.Watermarks;
|
|
using MediatR;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace ErsatzTV.Controllers.Api;
|
|
|
|
[ApiController]
|
|
public class WatermarkController(IMediator mediator) : ControllerBase
|
|
{
|
|
[HttpGet("/api/watermarks", Name = "GetWatermarks")]
|
|
[Tags("Watermarks")]
|
|
[EndpointSummary("Get all watermarks")]
|
|
[EndpointGroupName("general")]
|
|
[ProducesResponseType(typeof(List<WatermarkResponseModel>), StatusCodes.Status200OK)]
|
|
public async Task<List<WatermarkResponseModel>> GetAll(CancellationToken cancellationToken) =>
|
|
await mediator.Send(new GetAllWatermarksForApi(), cancellationToken);
|
|
}
|