WatermarkResponseModel gains ImageSource so a client can identify logo-driven presets generically instead of matching a user-editable name. Additive under the frozen-additive /api/v1 contract (#286). Adding a positional record parameter is source-breaking for existing constructor call sites, so the two test files that built the DTO positionally are updated. WatermarkHandlerTests now seeds its two rows with DIFFERENT image sources so the round-trip assertion proves the field is actually carried through the mapper rather than matching a constant on both. Regenerated v1.json, endpoint-index.md and v1.d.ts; check:api clean. Stripped the inherited UTF-8 BOM from Mapper.cs (#311 fix-as-you-touch). Refs #67
51 lines
1.8 KiB
C#
51 lines
1.8 KiB
C#
using ErsatzTV.Application.Artworks;
|
|
using ErsatzTV.Core.Api.Watermarks;
|
|
using ErsatzTV.Core.Domain;
|
|
|
|
namespace ErsatzTV.Application.Watermarks;
|
|
|
|
internal static class Mapper
|
|
{
|
|
internal static WatermarkResponseModel ProjectToResponseModel(ChannelWatermark watermark) =>
|
|
new(watermark.Id, watermark.Name, watermark.ImageSource);
|
|
|
|
internal static WatermarkFullResponseModel ProjectToFullResponseModel(ChannelWatermark watermark) =>
|
|
new(
|
|
watermark.Id,
|
|
watermark.Name,
|
|
watermark.Mode,
|
|
watermark.ImageSource,
|
|
watermark.Image,
|
|
watermark.OriginalContentType,
|
|
watermark.Location,
|
|
watermark.Size,
|
|
watermark.WidthPercent,
|
|
watermark.HorizontalMarginPercent,
|
|
watermark.VerticalMarginPercent,
|
|
watermark.FrequencyMinutes,
|
|
watermark.DurationSeconds,
|
|
watermark.Opacity,
|
|
watermark.OpacityExpression,
|
|
watermark.ZIndex,
|
|
watermark.PlaceWithinSourceContent);
|
|
|
|
public static WatermarkViewModel ProjectToViewModel(ChannelWatermark watermark) =>
|
|
new(
|
|
watermark.Id,
|
|
new ArtworkContentTypeModel(watermark.Image, watermark.OriginalContentType),
|
|
watermark.Name,
|
|
watermark.Mode,
|
|
watermark.ImageSource,
|
|
watermark.Location,
|
|
watermark.Size,
|
|
watermark.WidthPercent,
|
|
watermark.HorizontalMarginPercent,
|
|
watermark.VerticalMarginPercent,
|
|
watermark.FrequencyMinutes,
|
|
watermark.DurationSeconds,
|
|
watermark.Opacity,
|
|
watermark.PlaceWithinSourceContent,
|
|
watermark.OpacityExpression,
|
|
watermark.ZIndex);
|
|
}
|