57 lines
2.2 KiB
C#
57 lines
2.2 KiB
C#
using Managing.Domain.Statistics;
|
|
using static Managing.Common.Enums;
|
|
|
|
namespace Managing.Application.Abstractions.Repositories;
|
|
|
|
public interface IAgentSummaryRepository
|
|
{
|
|
Task<AgentSummary?> GetByUserIdAsync(int userId);
|
|
Task<AgentSummary?> GetByAgentNameAsync(string agentName);
|
|
Task<IEnumerable<AgentSummary>> GetAllAsync();
|
|
Task InsertAsync(AgentSummary agentSummary);
|
|
Task UpdateAsync(AgentSummary agentSummary);
|
|
Task SaveOrUpdateAsync(AgentSummary agentSummary);
|
|
|
|
/// <summary>
|
|
/// Gets paginated agent summaries with sorting and filtering
|
|
/// </summary>
|
|
/// <param name="page">Page number (1-based)</param>
|
|
/// <param name="pageSize">Number of items per page</param>
|
|
/// <param name="sortBy">Field to sort by</param>
|
|
/// <param name="sortOrder">Sort order (asc or desc)</param>
|
|
/// <param name="agentNames">Optional list of agent names to filter by</param>
|
|
/// <returns>Tuple containing the paginated results and total count</returns>
|
|
Task<(IEnumerable<AgentSummary> Results, int TotalCount)> GetPaginatedAsync(
|
|
int page,
|
|
int pageSize,
|
|
SortableFields sortBy,
|
|
string sortOrder,
|
|
IEnumerable<string>? agentNames = null);
|
|
Task<IEnumerable<AgentSummary>> GetAllAgentWithRunningBots();
|
|
|
|
/// <summary>
|
|
/// Updates only the agent name for a specific user's agent summary
|
|
/// </summary>
|
|
/// <param name="userId">The user ID</param>
|
|
/// <param name="agentName">The new agent name</param>
|
|
Task UpdateAgentNameAsync(int userId, string agentName);
|
|
|
|
/// <summary>
|
|
/// Gets the total count of agents
|
|
/// </summary>
|
|
/// <returns>Total number of agents</returns>
|
|
Task<int> GetTotalAgentCount();
|
|
|
|
/// <summary>
|
|
/// Increments the backtest count for a specific user's agent summary
|
|
/// </summary>
|
|
/// <param name="userId">The user ID</param>
|
|
Task IncrementBacktestCountAsync(int userId);
|
|
|
|
/// <summary>
|
|
/// Updates the total balance for a specific user's agent summary
|
|
/// </summary>
|
|
/// <param name="userId">The user ID</param>
|
|
/// <param name="totalBalance">The new total balance value</param>
|
|
Task UpdateTotalBalanceAsync(int userId, decimal totalBalance);
|
|
} |