- Add AgentState read model (Models/AgentState.cs) - Add IAgentStateRepository interface with GetAllAsync, GetBySessionKeyAsync, UpdateStatusAsync - Add AgentStateRepository EF Core implementation mapping Agent entity → AgentState model - Register IAgentStateRepository in DI (Program.cs) - Exclude ControlCenter sub-project from Api compilation Build: 0 warnings, 0 errors
27 lines
955 B
C#
27 lines
955 B
C#
using ControlCenter.Api.Models;
|
|
|
|
namespace ControlCenter.Api.Repositories;
|
|
|
|
/// <summary>
|
|
/// Repository interface for accessing and mutating Agent State.
|
|
/// Provides a clean abstraction over the EF Core data access layer.
|
|
/// </summary>
|
|
public interface IAgentStateRepository
|
|
{
|
|
/// <summary>
|
|
/// Retrieve all agent states.
|
|
/// </summary>
|
|
Task<IReadOnlyList<AgentState>> GetAllAsync(CancellationToken ct = default);
|
|
|
|
/// <summary>
|
|
/// Retrieve a single agent state by its session key.
|
|
/// Returns null if no agent is found with the given session key.
|
|
/// </summary>
|
|
Task<AgentState?> GetBySessionKeyAsync(string sessionKey, CancellationToken ct = default);
|
|
|
|
/// <summary>
|
|
/// Update the status of an agent by its primary key.
|
|
/// Returns true if the agent was found and updated, false otherwise.
|
|
/// </summary>
|
|
Task<bool> UpdateStatusAsync(Guid id, string status, CancellationToken ct = default);
|
|
} |