=== 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:
@@ -14,6 +14,7 @@ namespace adas_core.Infrastructure.Repositories;
|
||||
/// Repository implementation for managing Patient archive entities in MongoDB.
|
||||
/// Provides CRUD operations for historical/archived patient data.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=9d2c240 -->
|
||||
public class PatientArchiveRepository : MongoRepository<Patient>, IPatientArchiveRepository
|
||||
{
|
||||
private readonly ApiSettings _apiSettings;
|
||||
@@ -24,6 +25,7 @@ public class PatientArchiveRepository : MongoRepository<Patient>, IPatientArchiv
|
||||
/// <param name="apiSettings">API settings containing collection names configuration.</param>
|
||||
/// <param name="database">The MongoDB database instance.</param>
|
||||
/// <exception cref="ArgumentNullException">Thrown when apiSettings is null.</exception>
|
||||
/// <!-- aidoc:v1 sig=f8a321d body=d2b18a3 -->
|
||||
public PatientArchiveRepository(IOptions<ApiSettings> apiSettings, IMongoDatabase database) : base(database)
|
||||
{
|
||||
if (apiSettings == null) throw new ArgumentNullException(nameof(apiSettings));
|
||||
@@ -34,6 +36,7 @@ public class PatientArchiveRepository : MongoRepository<Patient>, IPatientArchiv
|
||||
/// Gets the name of the collection for archived patients.
|
||||
/// </summary>
|
||||
/// <returns>The collection name from API settings, or default "archive_patient".</returns>
|
||||
/// <!-- aidoc:v1 sig=94e22ff body=76e5629 -->
|
||||
public override string GetCollectionName()
|
||||
{
|
||||
return _apiSettings.ArchivePatient ?? "archive_patient";
|
||||
@@ -44,6 +47,7 @@ public class PatientArchiveRepository : MongoRepository<Patient>, IPatientArchiv
|
||||
/// </summary>
|
||||
/// <param name="patientNumber">The patient number to search for.</param>
|
||||
/// <returns>The Patient if found; otherwise, null.</returns>
|
||||
/// <!-- aidoc:v1 sig=09c89ab body=8d2454d -->
|
||||
public async Task<Patient?> FindByPatientNumber(string patientNumber)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(patientNumber)) return null;
|
||||
@@ -60,6 +64,7 @@ public class PatientArchiveRepository : MongoRepository<Patient>, IPatientArchiv
|
||||
/// Retrieves all archived patients from the collection.
|
||||
/// </summary>
|
||||
/// <returns>A list of all Patient entities in the archive.</returns>
|
||||
/// <!-- aidoc:v1 sig=e8bb639 body=57f77c8 -->
|
||||
public async Task<List<Patient>> FindAll()
|
||||
{
|
||||
var filterBuilder = Builders<Patient>.Filter;
|
||||
@@ -77,6 +82,8 @@ public class PatientArchiveRepository : MongoRepository<Patient>, IPatientArchiv
|
||||
/// <param name="patientNumber">The patient number to search for.</param>
|
||||
/// <param name="unitId">The unit ID (currently not used in query, kept for interface compatibility).</param>
|
||||
/// <returns>The unique Patient if exactly one match is found; otherwise, null if multiple or none.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=low kind=wrong_summary
|
||||
/// "Summary claims the method searches for an 'archived patient', but the code applies no archive-status filter; it only filters by patientNumber." -->
|
||||
public async Task<Patient?> SearchByPatientNumberAndDistinctUnit(string patientNumber, ObjectId unitId)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(patientNumber)) return null;
|
||||
@@ -96,6 +103,8 @@ public class PatientArchiveRepository : MongoRepository<Patient>, IPatientArchiv
|
||||
/// </summary>
|
||||
/// <param name="obj">The Patient entity to insert or merge.</param>
|
||||
/// <exception cref="Exception">Logs warning and silently fails on error.</exception>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=wrong_exception
|
||||
/// "The method catches Exception internally and swallows it (logs a warning); it never throws Exception to the caller, so documenting it via <exception cref=\"Exception\"> is misleading." -->
|
||||
public override async Task InsertOneAsync(Patient obj)
|
||||
{
|
||||
try
|
||||
@@ -154,6 +163,7 @@ public class PatientArchiveRepository : MongoRepository<Patient>, IPatientArchiv
|
||||
/// Creates the necessary indexes for the PatientArchive collection.
|
||||
/// Creates an index on patientNumber for improved query performance.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=4955da2 body=549d3bb -->
|
||||
public override async Task CreateIndexes()
|
||||
{
|
||||
var options = new CreateIndexOptions { Background = true, Unique = false };
|
||||
|
||||
Reference in New Issue
Block a user