Fix bot TOP 3
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
using Managing.Domain.Bots;
|
||||
using MediatR;
|
||||
using static Managing.Common.Enums;
|
||||
|
||||
namespace Managing.Application.ManageBot.Commands
|
||||
{
|
||||
public class GetTopBotsByPnLCommand : IRequest<IEnumerable<Bot>>
|
||||
{
|
||||
public IEnumerable<BotStatus> Statuses { get; }
|
||||
public int Count { get; }
|
||||
|
||||
public GetTopBotsByPnLCommand(IEnumerable<BotStatus> statuses, int count = 3)
|
||||
{
|
||||
Statuses = statuses;
|
||||
Count = count;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using Managing.Domain.Bots;
|
||||
using MediatR;
|
||||
using static Managing.Common.Enums;
|
||||
|
||||
namespace Managing.Application.ManageBot.Commands
|
||||
{
|
||||
public class GetTopBotsByRoiCommand : IRequest<IEnumerable<Bot>>
|
||||
{
|
||||
public IEnumerable<BotStatus> Statuses { get; }
|
||||
public int Count { get; }
|
||||
|
||||
public GetTopBotsByRoiCommand(IEnumerable<BotStatus> statuses, int count = 3)
|
||||
{
|
||||
Statuses = statuses;
|
||||
Count = count;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using Managing.Application.Abstractions.Repositories;
|
||||
using Managing.Application.ManageBot.Commands;
|
||||
using Managing.Domain.Bots;
|
||||
using MediatR;
|
||||
|
||||
namespace Managing.Application.ManageBot
|
||||
{
|
||||
public class GetTopBotsByPnLCommandHandler(IBotRepository botRepository)
|
||||
: IRequestHandler<GetTopBotsByPnLCommand, IEnumerable<Bot>>
|
||||
{
|
||||
public async Task<IEnumerable<Bot>> Handle(GetTopBotsByPnLCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
return await botRepository.GetTopBotsByPnLAsync(request.Statuses, request.Count);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using Managing.Application.Abstractions.Repositories;
|
||||
using Managing.Application.ManageBot.Commands;
|
||||
using Managing.Domain.Bots;
|
||||
using MediatR;
|
||||
|
||||
namespace Managing.Application.ManageBot
|
||||
{
|
||||
public class GetTopBotsByRoiCommandHandler(IBotRepository botRepository)
|
||||
: IRequestHandler<GetTopBotsByRoiCommand, IEnumerable<Bot>>
|
||||
{
|
||||
public async Task<IEnumerable<Bot>> Handle(GetTopBotsByRoiCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
return await botRepository.GetTopBotsByRoiAsync(request.Statuses, request.Count);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user