=== 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
@@ -40,6 +40,7 @@ public class ConfigPumpsService(
/// </summary>
/// <param name="obs">The pump observation to map, containing the alarm type used for configuration lookup.</param>
/// <returns>The mapped pump observation, or the original observation when mapping is skipped or the configuration lookup yields no result.</returns>
/// <!-- aidoc:v1 sig=daf9ea9 body=b1d8856 -->
public async Task<PumpObservation> Map(PumpObservation obs)
{
if (!_configPumpsRequired) return obs;
@@ -57,6 +58,7 @@ public class ConfigPumpsService(
/// Retrieves all available pump configurations from the underlying repository.
/// </summary>
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="ConfigPumps"/> if any are available, or <c>null</c> when no configurations exist.</returns>
/// <!-- aidoc:v1 sig=23fc0df body=05ec99d -->
public async Task<List<ConfigPumps>?> GetAllPumpConfigs()
{
return await configPumpsRepository.GetAllConfigs();
@@ -68,6 +70,7 @@ public class ConfigPumpsService(
/// </summary>
/// <param name="id">The unique identifier of the pump configuration to retrieve.</param>
/// <returns>A <see cref="ConfigPumps"/> instance if a matching configuration is found; otherwise, <c>null</c>.</returns>
/// <!-- aidoc:v1 sig=d9bd34a body=d1db9d5 -->
public async Task<ConfigPumps?> GetPumpConfigById(string id)
{
return await configPumpsRepository.FindById(id);
@@ -78,6 +81,7 @@ public class ConfigPumpsService(
/// </summary>
/// <param name="id">The unique identifier of the config pump to look up.</param>
/// <returns>A task that resolves to the list of <see cref="ConfigPumpItem"/> entries, or <c>null</c> if the config pump does not exist.</returns>
/// <!-- aidoc:v1 sig=68a23c4 body=0689fc9 -->
public async Task<List<ConfigPumpItem>?> GetConfigItems(string id)
{
var result = await configPumpsRepository.FindById(id);
@@ -91,6 +95,7 @@ public class ConfigPumpsService(
/// <param name="pumpConfig">The pump configuration to update, identified by its <see cref="ConfigPumps.Id"/>.</param>
/// <returns>A task representing the asynchronous operation, containing the updated <see cref="ConfigPumps"/>.</returns>
/// <exception cref="ConflictException">Thrown when the update operation fails.</exception>
/// <!-- aidoc:v1 sig=373d0cc body=519fb70 -->
public async Task<ConfigPumps?> UpdatePumpConfig(ConfigPumps pumpConfig)
{
var oldPumpConfig = configPumpsRepository.FindById(pumpConfig.Id);
@@ -106,6 +111,8 @@ public class ConfigPumpsService(
/// <param name="pumpConfig">The pump configuration to insert.</param>
/// <returns>The inserted <see cref="ConfigPumps"/> on success; otherwise, <c>null</c> when an error occurs during the operation.</returns>
/// <exception cref="ConflictException">Thrown when the inserted configuration cannot be found in the repository after insertion.</exception>
/// <!-- aidoc-review:v1 severity=high kind=extra_exception
/// "ConflictException is documented as thrown, but it is raised inside a try block whose catch handler logs it and returns null, so the exception never propagates to the caller." -->
public async Task<ConfigPumps?> InsertPumpConfig(ConfigPumps pumpConfig)
{
try
@@ -128,6 +135,7 @@ public class ConfigPumpsService(
/// </summary>
/// <param name="config">The <see cref="ConfigPumps"/> instance representing the pump configuration to delete.</param>
/// <returns>A task that resolves to <c>true</c> when the configuration is deleted and the audit log is recorded; <c>false</c> when the delete operation fails or an exception occurs.</returns>
/// <!-- aidoc:v1 sig=5589ecb body=49cc999 -->
public async Task<bool> DeletePumpConfig(ConfigPumps config)
{
try
@@ -156,6 +164,7 @@ public class ConfigPumpsService(
/// </summary>
/// <param name="obs">The pump observation for which to evaluate the retention policy.</param>
/// <returns>A task containing the retention result with the applicable policy and associated value, or a default NoDelete result when no policy is configured.</returns>
/// <!-- aidoc:v1 sig=57930e3 body=186775f -->
public async Task<ObservatitonRetentionResult?> RetentionActions(PumpObservation obs)
{
//TODO sacarlo de la configuración específica de Bombas
@@ -171,6 +180,7 @@ public class ConfigPumpsService(
/// <param name="obs">The pump observation that will receive the UI configuration.</param>
/// <param name="conf">The configuration source whose UI configuration is applied to <paramref name="obs"/> when present.</param>
/// <returns>A completed <see cref="Task{PumpObservation}"/> containing the updated observation.</returns>
/// <!-- aidoc:v1 sig=ad0f0ed body=76b8f24 -->
private static Task<PumpObservation> MapConf(PumpObservation obs, ConfigPumpItem conf)
{
if (conf.UiConfiguration != null && conf.UiConfiguration.Count != 0)
@@ -184,6 +194,7 @@ public class ConfigPumpsService(
/// </summary>
/// <param name="alarmType">The string representation of the alarm type to look up; if it cannot be parsed into a valid <see cref="PumpEnum.AlarmType"/>, the method returns <c>null</c>.</param>
/// <returns>A <see cref="ConfigPumpItem"/> whose <c>AlarmType</c> matches the parsed value, or <c>null</c> if parsing fails or no matching item is found.</returns>
/// <!-- aidoc:v1 sig=bc81e4a body=6b0def6 -->
private async Task<ConfigPumpItem?> Get(string alarmType)
{
if (!Enum.TryParse(alarmType, out PumpEnum.AlarmType alarmTypeParsed))
@@ -198,6 +209,7 @@ public class ConfigPumpsService(
/// </summary>
/// <param name="pobs">The pump observation whose <c>MessageType</c> is used to locate the corresponding configuration entry.</param>
/// <returns>A <see cref="ConfigPumpItem"/> matching the observation's message type, or <c>null</c> if the configuration is unavailable or no matching item exists.</returns>
/// <!-- aidoc:v1 sig=41e31d5 body=63aa76f -->
private async Task<ConfigPumpItem?> Get(PumpObservation pobs)
{
var config = await GetConfig();
@@ -208,6 +220,7 @@ public class ConfigPumpsService(
/// Returns a null list if the underlying configuration is not available.
/// </summary>
/// <returns>A task containing a list of <see cref="ConfigPumpItem"/> objects, or <c>null</c> if the configuration could not be retrieved.</returns>
/// <!-- aidoc:v1 sig=e2506bb body=a5ff078 -->
public async Task<List<ConfigPumpItem>?> Get()
{
var result = await GetConfig();
@@ -220,6 +233,7 @@ public class ConfigPumpsService(
/// Falls back to fetching from the repository when the cache is missing or stale, and returns <c>null</c> if an error occurs during retrieval.
/// </summary>
/// <returns>A task containing the <see cref="ConfigPumps"/> instance if available; otherwise, <c>null</c> when the repository lookup fails.</returns>
/// <!-- aidoc:v1 sig=5717dca body=174bbb3 -->
private async Task<ConfigPumps?> GetConfig()
{
try