=== 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:
@@ -9,6 +9,7 @@ namespace adas_core.Infrastructure.Repositories;
|
||||
/// <summary>
|
||||
/// Repository for managing ConfigPumps in MongoDB. Provides methods to retrieve, update, and delete pump configurations.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=268862a -->
|
||||
public class ConfigPumpsRepository : MongoRepository<ConfigPumps>, IConfigPumpsRepository
|
||||
{
|
||||
private readonly ApiSettings _apiSettings;
|
||||
@@ -19,6 +20,7 @@ public class ConfigPumpsRepository : MongoRepository<ConfigPumps>, IConfigPumpsR
|
||||
/// <param name="apiSettings">The API settings.</param>
|
||||
/// <param name="database">The MongoDB database instance.</param>
|
||||
/// <exception cref="ArgumentNullException">Thrown when apiSettings is null.</exception>
|
||||
/// <!-- aidoc:v1 sig=ee04ef2 body=d2b18a3 -->
|
||||
public ConfigPumpsRepository(IOptions<ApiSettings> apiSettings, IMongoDatabase database) : base(database)
|
||||
{
|
||||
if (apiSettings == null) throw new ArgumentNullException(nameof(apiSettings));
|
||||
@@ -30,6 +32,7 @@ public class ConfigPumpsRepository : MongoRepository<ConfigPumps>, IConfigPumpsR
|
||||
/// Gets the name of the MongoDB collection for ConfigPumps. Uses the value from API settings or defaults to "config_pumps".
|
||||
/// </summary>
|
||||
/// <returns>The name of the MongoDB collection for ConfigPumps.</returns>
|
||||
/// <!-- aidoc:v1 sig=94e22ff body=04254e5 -->
|
||||
public override string GetCollectionName()
|
||||
{
|
||||
return _apiSettings.ConfigPumps ?? "config_pumps";
|
||||
@@ -39,6 +42,8 @@ public class ConfigPumpsRepository : MongoRepository<ConfigPumps>, IConfigPumpsR
|
||||
/// Retrieves all ConfigPumps documents from the MongoDB collection. Returns a list of ConfigPumps or null if no documents are found.
|
||||
/// </summary>
|
||||
/// <returns>A list of ConfigPumps or null if no documents are found.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_returns
|
||||
/// "Documentation states the method returns null if no documents are found, but the code always returns a list (ToList() returns an empty list when no documents match, never null)." -->
|
||||
public async Task<List<ConfigPumps>?> GetAllConfigs()
|
||||
{
|
||||
var result = await Collection.FindAsync(Builders<ConfigPumps>.Filter.Empty);
|
||||
@@ -51,6 +56,7 @@ public class ConfigPumpsRepository : MongoRepository<ConfigPumps>, IConfigPumpsR
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the ConfigPumps document.</param>
|
||||
/// <returns>The ConfigPumps document if found, or null if not found.</returns>
|
||||
/// <!-- aidoc:v1 sig=00c3a1c body=e64c9f9 -->
|
||||
public async Task<ConfigPumps?> FindById(string id)
|
||||
{
|
||||
var result = await Collection.FindAsync(Builders<ConfigPumps>.Filter.Eq(x => x.Id, id));
|
||||
@@ -65,6 +71,7 @@ public class ConfigPumpsRepository : MongoRepository<ConfigPumps>, IConfigPumpsR
|
||||
/// </summary>
|
||||
/// <param name="config">The ConfigPumps object containing the updated data.</param>
|
||||
/// <returns>The updated ConfigPumps document if found, or null if not found.</returns>
|
||||
/// <!-- aidoc:v1 sig=cc52f62 body=3d18e97 -->
|
||||
public async Task<ConfigPumps?> UpdateConfig(ConfigPumps config)
|
||||
{
|
||||
var filter = Builders<ConfigPumps>.Filter.Eq("_id", config.Id);
|
||||
@@ -80,6 +87,7 @@ public class ConfigPumpsRepository : MongoRepository<ConfigPumps>, IConfigPumpsR
|
||||
/// </summary>
|
||||
/// <param name="config">The ConfigPumps object to be deleted.</param>
|
||||
/// <returns>True if the deletion was successful, false otherwise.</returns>
|
||||
/// <!-- aidoc:v1 sig=4d3028e body=1b2f41a -->
|
||||
public async Task<bool> DeleteConfig(ConfigPumps config)
|
||||
{
|
||||
var filter = Builders<ConfigPumps>.Filter.Eq("_id", config.Id);
|
||||
|
||||
Reference in New Issue
Block a user