Enhance show deletion functionality to support media removal option
Updated the DeleteShowCommand and its handler to include an optional parameter for media deletion, allowing users to remove associated media files when deleting a show. Refactored related components and API calls to accommodate this new feature, ensuring a seamless user experience. Additionally, updated localization strings to reflect the new functionality and adjusted tests to verify the correct behavior of the deletion process with and without media.
This commit is contained in:
@@ -8,6 +8,7 @@ using TeleWave.Application.Broadcast.ListChannels;
|
||||
using TeleWave.Application.Common.Interfaces;
|
||||
using TeleWave.Application.Library.DeleteShow;
|
||||
using TeleWave.Application.Library.GetShow;
|
||||
using TeleWave.Application.Media;
|
||||
using TeleWave.Application.Programming.Groups;
|
||||
using TeleWave.Application.Tests.Support;
|
||||
using TeleWave.Domain.Broadcast;
|
||||
@@ -24,6 +25,9 @@ public class QueryHandlersTests
|
||||
private static GroupMembershipCleaner GroupCleaner(IAppDbContext db) =>
|
||||
new(db, GroupServices.Stats(db));
|
||||
|
||||
private static ShowMediaEraser Eraser(IAppDbContext db) =>
|
||||
new(db, Substitute.For<IMediaStorage>());
|
||||
|
||||
[Fact]
|
||||
public async Task GetChannel_UnknownId_ReturnsNotFound()
|
||||
{
|
||||
@@ -153,13 +157,13 @@ public class QueryHandlersTests
|
||||
}
|
||||
|
||||
await using var db = fixture.New();
|
||||
var missing = await new DeleteShowCommandHandler(db, GroupCleaner(db)).Handle(
|
||||
var missing = await new DeleteShowCommandHandler(db, GroupCleaner(db), Eraser(db)).Handle(
|
||||
new DeleteShowCommand(Guid.NewGuid()),
|
||||
CancellationToken.None
|
||||
);
|
||||
Assert.False(missing.IsSuccess);
|
||||
|
||||
var ok = await new DeleteShowCommandHandler(db, GroupCleaner(db)).Handle(
|
||||
var ok = await new DeleteShowCommandHandler(db, GroupCleaner(db), Eraser(db)).Handle(
|
||||
new DeleteShowCommand(show.Id),
|
||||
CancellationToken.None
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user