=== Summary: 675 files | 7 generated | 484 fresh | 4605 untracked | 4268 adopted | 355 marked | 466 validated-ok | 2+0 stale (sig+body) | 0 skipped | 0 failed | elapsed 11:08:11.442 (40091.44s) ===
This commit is contained in:
@@ -11,6 +11,7 @@ namespace adas_core.Infrastructure.Repositories
|
||||
/// Provides a repository implementation for <see cref="PumpState"/> entities backed by a MongoDB data store.
|
||||
/// </summary>
|
||||
/// <remarks>Inherits base functionality from <see cref="MongoRepository{T}"/> and implements the <see cref="IPumpStateRepository"/> contract.</remarks>
|
||||
/// <!-- aidoc:v1 sig=e8fa3b3 -->
|
||||
public class PumpStateRepository : MongoRepository<PumpState>, IPumpStateRepository
|
||||
{
|
||||
private readonly ApiSettings _apiSettings;
|
||||
@@ -32,6 +33,7 @@ namespace adas_core.Infrastructure.Repositories
|
||||
/// Retrieves the collection name for pump states, returning the configured value from API settings or the default name "pump_states" when the setting is not provided.
|
||||
/// </summary>
|
||||
/// <returns>The configured pump states collection name, or the default value "pump_states" if the setting is null.</returns>
|
||||
/// <!-- aidoc:v1 sig=94e22ff body=31eaf80 -->
|
||||
public override string GetCollectionName()
|
||||
{
|
||||
return _apiSettings.PumpStates ?? "pump_states";
|
||||
@@ -71,6 +73,7 @@ namespace adas_core.Infrastructure.Repositories
|
||||
/// </summary>
|
||||
/// <param name="deviceId">The unique identifier of the device whose pump state should be looked up.</param>
|
||||
/// <returns>A <see cref="PumpState"/> instance if a matching record is found; otherwise, null.</returns>
|
||||
/// <!-- aidoc:v1 sig=bab429b body=ea4c529 -->
|
||||
public async Task<PumpState?> FindByDeviceIdAsync(string deviceId)
|
||||
{
|
||||
return await Collection.Find(x => x.DeviceId == deviceId).FirstOrDefaultAsync();
|
||||
@@ -80,6 +83,7 @@ namespace adas_core.Infrastructure.Repositories
|
||||
/// Inserts the specified <see cref="PumpState"/> or updates the existing one identified by its <c>DeviceId</c>. If a matching record is found, its identifier is reused; otherwise a new identifier is generated when the provided one is empty.
|
||||
/// </summary>
|
||||
/// <param name="state">The pump state to persist. Its <c>Id</c> is preserved or assigned based on whether a record with the same <c>DeviceId</c> already exists.</param>
|
||||
/// <!-- aidoc:v1 sig=5ce0824 body=9517005 -->
|
||||
public async Task UpsertAsync(PumpState state)
|
||||
{
|
||||
var existing = await Collection
|
||||
@@ -102,6 +106,7 @@ namespace adas_core.Infrastructure.Repositories
|
||||
/// Asynchronously retrieves all <see cref="PumpState"/> records from the data store.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing an <see cref="IEnumerable{T}"/> of all <see cref="PumpState"/> records; an empty collection is returned if no records exist.</returns>
|
||||
/// <!-- aidoc:v1 sig=22c3173 body=c62f88b -->
|
||||
public async Task<IEnumerable<PumpState>> GetAllAsync()
|
||||
{
|
||||
return await Collection.Find(Builders<PumpState>.Filter.Empty).ToListAsync();
|
||||
|
||||
Reference in New Issue
Block a user