using MediatR; using Modules.Library.Application.Gateways; using Modules.Rating.Api.Commands; namespace Modules.Library.Application.Commands.Anime.Title; public class RateTitleCommand : IRequest { public Guid TitleId { get; set; } public ushort RatePercentage { get; set; } } public class RateTitleCommandHandler(IAnimeTitleGateway titleGateway, IMediator mediator) : IRequestHandler { public async Task Handle(RateTitleCommand request, CancellationToken cancellationToken) { var subjectId = new Guid("8393230f-78e3-473b-a5dc-3221917e0aeb"); //user var title = await titleGateway.GetById(request.TitleId); if (title != null && !title.Deleted) { await mediator.Send(new RateObjectCommand { ObjectId = title.Id, SubjectId = subjectId, RatePercentage = request.RatePercentage }); } return Unit.Value; } }