rama creada apartir de master en j
This commit is contained in:
@@ -7,11 +7,22 @@ using MongoDB.Bson;
|
||||
|
||||
namespace adas_core.Application.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Provides an implementation of the IAlertValuesService interface for managing alert values
|
||||
/// using a configuration observation repository.
|
||||
/// </summary>
|
||||
public class AlertValuesService(IConfigObservationRepository alertValueRepository) : IAlertValuesService
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves a <see cref="ConfigObservation"/> by its unique identifier from the alert value repository.
|
||||
/// Throws a <see cref="NotFoundException"/> when no matching resource is found.
|
||||
/// </summary>
|
||||
/// <param name="key">The unique identifier of the configuration observation to retrieve.</param>
|
||||
/// <returns>The matching <see cref="ConfigObservation"/> if found.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when no configuration observation exists for the specified <paramref name="key"/>.</exception>
|
||||
public async Task<ConfigObservation?> FindByKey(ObjectId key)
|
||||
{
|
||||
return await alertValueRepository.FindById(key) ??
|
||||
throw new NotFoundException(HttpEnum.ErrorMessage.NotFoundResourceMissing);
|
||||
}
|
||||
{
|
||||
return await alertValueRepository.FindById(key) ??
|
||||
throw new NotFoundException(HttpEnum.ErrorMessage.NotFoundResourceMissing);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user