Add audience categorization for shows: implement ShowAudience type, update related API endpoints, and enhance frontend components for audience selection and display. Modify data structures to support audience information in show creation and retrieval processes.
This commit is contained in:
@@ -8,7 +8,9 @@ using TeleWave.Application.Library.GetShow;
|
||||
using TeleWave.Application.Library.ListShows;
|
||||
using TeleWave.Application.Library.RemoveEpisode;
|
||||
using TeleWave.Application.Library.RenameShow;
|
||||
using TeleWave.Application.Library.SetShowAudience;
|
||||
using TeleWave.Application.Library.SetShowOriginalName;
|
||||
using TeleWave.Domain.Library;
|
||||
using TeleWave.Infrastructure.Identity;
|
||||
|
||||
namespace TeleWave.Api.Endpoints;
|
||||
@@ -28,6 +30,7 @@ public static class ShowEndpoints
|
||||
admin
|
||||
.MapPut("/{id:guid}/original-name", SetOriginalName)
|
||||
.Produces(StatusCodes.Status204NoContent);
|
||||
admin.MapPut("/{id:guid}/audience", SetAudience).Produces(StatusCodes.Status204NoContent);
|
||||
admin.MapDelete("/{id:guid}", DeleteShow).Produces(StatusCodes.Status204NoContent);
|
||||
admin
|
||||
.MapPost("/{id:guid}/episodes", AddEpisode)
|
||||
@@ -98,6 +101,20 @@ public static class ShowEndpoints
|
||||
return result.ToHttpResult();
|
||||
}
|
||||
|
||||
private static async Task<IResult> SetAudience(
|
||||
Guid id,
|
||||
SetShowAudienceBody body,
|
||||
ISender sender,
|
||||
CancellationToken cancellationToken
|
||||
)
|
||||
{
|
||||
var result = await sender.Send(
|
||||
new SetShowAudienceCommand(id, body.Audience),
|
||||
cancellationToken
|
||||
);
|
||||
return result.ToHttpResult();
|
||||
}
|
||||
|
||||
private static async Task<IResult> DeleteShow(
|
||||
Guid id,
|
||||
ISender sender,
|
||||
@@ -141,3 +158,5 @@ public sealed record AddEpisodeBody(Guid MediaAssetId);
|
||||
public sealed record RenameShowBody(string Name);
|
||||
|
||||
public sealed record SetShowOriginalNameBody(string? OriginalName);
|
||||
|
||||
public sealed record SetShowAudienceBody(ShowAudience Audience);
|
||||
|
||||
Reference in New Issue
Block a user