=== 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:
julian
2026-06-28 02:50:05 -07:00
parent a19fb90902
commit 586f02a2ca
654 changed files with 5260 additions and 0 deletions
@@ -11,6 +11,7 @@ namespace adas_core.Infrastructure.Repositories;
/// <summary>
/// Represents a MongoDB-based repository for <see cref="PumpAlarmState"/> entities, providing concrete data access functionality defined by the <see cref="IPumpAlarmStateRepository"/> contract.
/// </summary>
/// <!-- aidoc:v1 sig=86597ed -->
public class PumpAlarmStateRepository : MongoRepository<PumpAlarmState>, IPumpAlarmStateRepository
{
private readonly ApiSettings _apiSettings;
@@ -33,6 +34,7 @@ public class PumpAlarmStateRepository : MongoRepository<PumpAlarmState>, IPumpAl
/// Gets the collection name for the pump alarm state, returning the value configured in the API settings or the default "pump_alarm_state" when the configuration is not set.
/// </summary>
/// <returns>The configured collection name, or the default "pump_alarm_state" if the API setting is null.</returns>
/// <!-- aidoc:v1 sig=94e22ff body=e7678e2 -->
public override string GetCollectionName()
{
return _apiSettings.PumpAlarmState ?? "pump_alarm_state";
@@ -77,6 +79,7 @@ public class PumpAlarmStateRepository : MongoRepository<PumpAlarmState>, IPumpAl
/// <param name="alarmType">The optional alarm type used to further narrow the filter. When <c>null</c>, the alarm type is not applied.</param>
/// <param name="alarmCodeMdc">The optional alarm code (MDC) used to further narrow the filter. Ignored when <c>null</c>, empty, or whitespace.</param>
/// <returns>A <see cref="PumpAlarmState"/> instance if a matching record is found; otherwise, <c>null</c>.</returns>
/// <!-- aidoc:v1 sig=6935479 body=32e97b5 -->
public async Task<PumpAlarmState?> FindActiveAsync(string deviceId, PumpEnum.AlarmType? alarmType, string? alarmCodeMdc = null)
{
var filter = Builders<PumpAlarmState>.Filter.Eq(x => x.DeviceId, deviceId);
@@ -128,6 +131,7 @@ public class PumpAlarmStateRepository : MongoRepository<PumpAlarmState>, IPumpAl
/// <param name="deviceId">The identifier of the device whose alarm state records should be removed. Used as a mandatory filter criterion.</param>
/// <param name="alarmType">The optional alarm type to further restrict which records are deleted. When <see langword="null"/>, records of any alarm type for the device are removed.</param>
/// <param name="alarmCodeMdc">The optional alarm code MDC used to further narrow the deletion. Blank or whitespace values are ignored.</param>
/// <!-- aidoc:v1 sig=13aeac3 body=e8846f6 -->
public async Task RemoveAsync(string? deviceId, PumpEnum.AlarmType? alarmType, string? alarmCodeMdc = null)
{
var filter = Builders<PumpAlarmState>.Filter.Eq(x => x.DeviceId, deviceId);
@@ -145,6 +149,7 @@ public class PumpAlarmStateRepository : MongoRepository<PumpAlarmState>, IPumpAl
/// Asynchronously deletes all records associated with the specified patient identifier by removing every document whose <c>PatientId</c> matches the supplied value.
/// </summary>
/// <param name="patientId">The unique identifier of the patient whose associated records should be removed.</param>
/// <!-- aidoc:v1 sig=4776e51 body=69c2fe9 -->
public async Task DeleteByPatientId(ObjectId patientId)
{
await Collection.DeleteManyAsync(p => p.PatientId == patientId);
@@ -155,6 +160,7 @@ public class PumpAlarmStateRepository : MongoRepository<PumpAlarmState>, IPumpAl
/// </summary>
/// <param name="deviceId">The unique identifier of the device whose pump alarm states are being queried.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains an <see cref="IEnumerable{PumpAlarmState}"/> with the pump alarm states matching the provided device identifier.</returns>
/// <!-- aidoc:v1 sig=a3f8899 body=0854c79 -->
public async Task<IEnumerable<PumpAlarmState>> FindAllActiveByDeviceAsync(string deviceId)
{
return await Collection.Find(x => x.DeviceId == deviceId).ToListAsync();
@@ -167,6 +173,7 @@ public class PumpAlarmStateRepository : MongoRepository<PumpAlarmState>, IPumpAl
/// <param name="newId">The new <see cref="MongoDB.Bson.ObjectId"/> value to assign to the field.</param>
/// <param name="oldId">The existing <see cref="MongoDB.Bson.ObjectId"/> value used to locate matching documents.</param>
/// <returns>The number of documents that were modified by the update operation.</returns>
/// <!-- aidoc:v1 sig=885ce8c body=b35cab3 -->
public async Task<long> UpdateManyObjectIdByFieldNameAsync(string fieldName, ObjectId newId, ObjectId oldId)
{
var filter = Builders<PumpAlarmState>.Filter.Eq(fieldName, oldId);