=== 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:
@@ -10,6 +10,7 @@ namespace adas_core.Infrastructure.Repositories;
|
||||
/// <summary>
|
||||
/// Repository for managing archived patient appointments in MongoDB. This repository provides methods to insert, delete, and manage archived appointments, ensuring efficient storage and retrieval of historical appointment data.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=fd51b07 -->
|
||||
public class AppointmentArchiveRepository : MongoRepository<PatientAppointment>, IAppointmentArchiveRepository
|
||||
{
|
||||
/// <summary>
|
||||
@@ -24,6 +25,8 @@ public class AppointmentArchiveRepository : MongoRepository<PatientAppointment>,
|
||||
/// <param name="apiSettings">The API settings containing configuration for the archive collection.</param>
|
||||
/// <param name="database">The MongoDB database instance.</param>
|
||||
/// <exception cref="ArgumentNullException">Thrown when any of the input parameters are null.</exception>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=wrong_exception
|
||||
/// "The exception description states it is 'Thrown when any of the input parameters are null', but only apiSettings is null-checked; database is passed to the base constructor without a null check." -->
|
||||
public AppointmentArchiveRepository(IOptions<ApiSettings> apiSettings, IMongoDatabase database) : base(database)
|
||||
{
|
||||
if (apiSettings == null) throw new ArgumentNullException(nameof(apiSettings));
|
||||
@@ -37,6 +40,7 @@ public class AppointmentArchiveRepository : MongoRepository<PatientAppointment>,
|
||||
/// </summary>
|
||||
/// <param name="appointment">The patient appointment to be inserted into the archive collection.</param>
|
||||
/// <returns>A task representing the asynchronous operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=160dca2 body=ec779ee -->
|
||||
public override async Task InsertOneAsync(PatientAppointment appointment)
|
||||
{
|
||||
await Collection.InsertOneAsync(appointment);
|
||||
@@ -47,6 +51,7 @@ public class AppointmentArchiveRepository : MongoRepository<PatientAppointment>,
|
||||
/// </summary>
|
||||
/// <param name="date">The date before which all patient appointments should be deleted.</param>
|
||||
/// <returns>A task representing the asynchronous operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=63daa66 body=c6d74c3 -->
|
||||
public async Task DeleteBeforeDate(DateTime date)
|
||||
{
|
||||
var filter = Builders<PatientAppointment>.Filter.Lt(pa => pa.CreateTime, date);
|
||||
@@ -59,6 +64,7 @@ public class AppointmentArchiveRepository : MongoRepository<PatientAppointment>,
|
||||
/// </summary>
|
||||
/// <param name="appointment">The collection of patient appointments to be inserted into the archive.</param>
|
||||
/// <returns>A task representing the asynchronous operation, with the result being the count of inserted documents.</returns>
|
||||
/// <!-- aidoc:v1 sig=c7c2d89 body=e3ee2bb -->
|
||||
public async Task<long> InsertBatch(IEnumerable<PatientAppointment> appointment)
|
||||
{
|
||||
var writes = new List<WriteModel<PatientAppointment>>();
|
||||
@@ -74,6 +80,7 @@ public class AppointmentArchiveRepository : MongoRepository<PatientAppointment>,
|
||||
/// If the collection name is not specified in the settings, it defaults to "archive_patients_appointments".
|
||||
/// </summary>
|
||||
/// <returns>The name of the MongoDB collection for archived patient appointments.</returns>
|
||||
/// <!-- aidoc:v1 sig=94e22ff body=6f721df -->
|
||||
public override string GetCollectionName()
|
||||
{
|
||||
return _apiSettings.ArchivePatientsAppointments ?? "archive_patients_appointments";
|
||||
@@ -83,6 +90,7 @@ public class AppointmentArchiveRepository : MongoRepository<PatientAppointment>,
|
||||
/// Creates indexes on the MongoDB collection for archived patient appointments to optimize query performance. This method defines the necessary indexes, such as an index on the "patientid" field, and ensures that they are created in the background without blocking other operations.
|
||||
/// </summary>
|
||||
/// <returns>A task representing the asynchronous operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=4955da2 body=1a9cdb6 -->
|
||||
public override async Task CreateIndexes()
|
||||
{
|
||||
var options = new CreateIndexOptions<PatientAppointment> { Background = true, Unique = false };
|
||||
|
||||
Reference in New Issue
Block a user