Table of Contents

Class PoCSettingsRepository

Namespace
adas_core.Infrastructure.Repositories
Assembly
adas-core.Infrastructure.dll

Represents a MongoDB-backed repository for PoCSettings entities, implementing the IPoCSettingsRepository contract to provide data access operations.

public class PoCSettingsRepository : MongoRepository<PoCSettings>, IPoCSettingsRepository, IMongoRepository<PoCSettings>
Inheritance
PoCSettingsRepository
Implements
Inherited Members
Extension Methods

Constructors

PoCSettingsRepository(IOptions<ApiSettings>, IMongoDatabase)

public PoCSettingsRepository(IOptions<ApiSettings> apiSettings, IMongoDatabase database)

Parameters

apiSettings IOptions<ApiSettings>
database IMongoDatabase

Methods

CreateIndexes()

Creates the MongoDB indexes required for the PoCSettings collection, applying non-unique background indexing on the patientLocation field.

public override Task CreateIndexes()

Returns

Task

Delete(ObjectId)

Deletes the PoCSettings document matching the specified identifier from the collection.

public Task Delete(ObjectId id)

Parameters

id ObjectId

The unique identifier of the PoCSettings document to delete.

Returns

Task

FindAll()

Retrieves all PoCSettings records from the collection. If an error occurs during the retrieval, the exception is logged and an empty list is returned as a fallback.

public Task<List<PoCSettings>> FindAll()

Returns

Task<List<PoCSettings>>

A task that represents the asynchronous operation. The task result contains a list of all PoCSettings records, or an empty list if an error occurs.

FindById(ObjectId)

Retrieves a PoCSettings document from the collection by its unique identifier. Returns null when no matching document is found or when an error occurs while querying the database.

public Task<PoCSettings?> FindById(ObjectId id)

Parameters

id ObjectId

The MongoDB.Bson.ObjectId used to locate the PoCSettings document.

Returns

Task<PoCSettings>

A task that represents the asynchronous operation. The task result contains the matching PoCSettings or null if not found.

FindByLocation(PatientLocation)

Retrieves the first PoCSettings record from the collection where the PatientLocation property is not null.

public Task<PoCSettings?> FindByLocation(PatientLocation location)

Parameters

location PatientLocation

The patient location provided as search criteria. Detailed attribute-based filtering by location fields is currently commented out.

Returns

Task<PoCSettings>

The first matching PoCSettings record, or null if no record is found.

GetCollectionName()

Retrieves the collection name used for Proof of Concept (PoC) settings, returning the value from the API settings or the default "poc_settings" when no value is configured.

public override string GetCollectionName()

Returns

string

The configured PoC settings collection name, or "poc_settings" as a fallback when _apiSettings.PoCSettings is null.

Update(PoCSettings)

Updates the existing PoC (Proof of Concept) settings asynchronously. If the update fails, the exception is logged and rethrown to the caller.

public Task Update(PoCSettings pocSettings)

Parameters

pocSettings PoCSettings

The PoC settings entity to be updated, identified by its Id.

Returns

Task