using MediatR; using Modules.Library.Application.Commands.CommonModels; using Modules.Library.Application.Gateways; namespace Modules.Library.Application.Commands.Anime.Title.Properties.RelatedContent; public class AddRelatedContentCommand : IRequest { public Guid TitleId { get; set; } public MediaInfoType Type { get; set; } public string Url { get; set; } = default!; public string ContentType { get; set; } = default!; } public class AddRelatedContentCommandHandler(IAnimeTitleGateway titleGateway) : IRequestHandler { public async Task Handle(AddRelatedContentCommand request, CancellationToken cancellationToken) { var title = await titleGateway.GetById(request.TitleId); title.CommonProperties.AddRelatedContent(request.Url, (Domain.Entities.MediaInfoType)request.Type, request.ContentType); await titleGateway.Update(title); return Unit.Value; } }