=== 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,8 @@ namespace adas_core.Infrastructure.Repositories;
|
||||
/// implementing the contract defined by <see cref="ISectionRepository"/>.
|
||||
/// </summary>
|
||||
/// <typeparam name="Section">The type of the section entity managed by this repository.</typeparam>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "The documentation uses <typeparamref name='Section'/> in the summary and declares a <typeparam name='Section'> element on a non-generic class, misrepresenting the class as having a type parameter when Section is only a type argument to the generic base class MongoRepository<Section>." -->
|
||||
public class SectionRepository : MongoRepository<Section>, ISectionRepository
|
||||
{
|
||||
private readonly ApiSettings _apiSettings;
|
||||
@@ -38,6 +40,7 @@ public class SectionRepository : MongoRepository<Section>, ISectionRepository
|
||||
/// Gets the configuration sections collection name from the API settings, falling back to a default value when not configured.
|
||||
/// </summary>
|
||||
/// <returns>The configured collection name, or "config_sections" if <c>_apiSettings.ConfigSections</c> is null.</returns>
|
||||
/// <!-- aidoc:v1 sig=94e22ff body=538109a -->
|
||||
public override string GetCollectionName()
|
||||
{
|
||||
return _apiSettings.ConfigSections ?? "config_sections";
|
||||
@@ -47,6 +50,7 @@ public class SectionRepository : MongoRepository<Section>, ISectionRepository
|
||||
/// Retrieves all <see cref="Section"/> documents from the underlying collection by querying with an empty filter.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of all <see cref="Section"/> documents found in the collection.</returns>
|
||||
/// <!-- aidoc:v1 sig=c63d5ab body=5e7c572 -->
|
||||
public async Task<List<Section>> GetAll()
|
||||
{
|
||||
var result = await Collection.FindAsync(Builders<Section>.Filter.Empty);
|
||||
@@ -59,6 +63,7 @@ public class SectionRepository : MongoRepository<Section>, ISectionRepository
|
||||
/// </summary>
|
||||
/// <param name="section">The section title used to look up the matching <see cref="Section"/>.</param>
|
||||
/// <returns>The first matching <see cref="Section"/>, or <c>null</c> if no section with the given title is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=657d14e body=7fd0ba3 -->
|
||||
public async Task<Section?> FindBySection(string section)
|
||||
{
|
||||
var result = await Collection.FindAsync(Builders<Section>.Filter.Eq(x => x.SectionTitle, section));
|
||||
@@ -71,6 +76,7 @@ public class SectionRepository : MongoRepository<Section>, ISectionRepository
|
||||
/// </summary>
|
||||
/// <param name="pointOfCare">The point of care identifier used to filter the sections.</param>
|
||||
/// <returns>The first matching <see cref="Section"/>, or <c>null</c> if no section is found.</returns>
|
||||
/// <!-- aidoc:v1 sig=a604321 body=7d830b2 -->
|
||||
public async Task<Section?> FindByPointOfCare(string pointOfCare)
|
||||
{
|
||||
var result = await Collection.FindAsync(Builders<Section>.Filter.Eq(x => x.PointOfCare, pointOfCare));
|
||||
@@ -84,6 +90,7 @@ public class SectionRepository : MongoRepository<Section>, ISectionRepository
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the section to retrieve.</param>
|
||||
/// <returns>A task containing the matching <see cref="Section"/> if found; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=b74d29e body=35f3782 -->
|
||||
public async Task<Section?> FindById(string id)
|
||||
{
|
||||
var result = await Collection.FindAsync(Builders<Section>.Filter.Eq(x => x.Id, id));
|
||||
@@ -96,6 +103,7 @@ public class SectionRepository : MongoRepository<Section>, ISectionRepository
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the section to locate.</param>
|
||||
/// <returns>A <see cref="Section"/> instance if a document with the given identifier exists; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=d503cfd body=43632c9 -->
|
||||
public async Task<Section?> FindById(object id)
|
||||
{
|
||||
var result = await Collection.FindAsync(Builders<Section>.Filter.Eq(x => x._id, id));
|
||||
@@ -109,6 +117,8 @@ public class SectionRepository : MongoRepository<Section>, ISectionRepository
|
||||
/// </summary>
|
||||
/// <param name="location">The patient location containing the unit name and bed used to locate the corresponding sections.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of sections matching the provided patient location; an empty list is returned when no matching sections are found.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=low kind=wrong_summary
|
||||
/// "The summary refers to 'active sections,' but the code only checks `box.IsActive`; the sections themselves are not filtered by any active state." -->
|
||||
public async Task<List<Section>> FindByLocation(PatientLocation location)
|
||||
{
|
||||
//can not filter to Collection the where condition, it throws System.InvalidOperationException: '{}.pointOfCare is not supported.'
|
||||
@@ -128,6 +138,7 @@ public class SectionRepository : MongoRepository<Section>, ISectionRepository
|
||||
/// </summary>
|
||||
/// <param name="section">The section to insert into the collection.</param>
|
||||
/// <returns>The inserted <see cref="Section"/> on success, or <c>null</c> if the operation fails.</returns>
|
||||
/// <!-- aidoc:v1 sig=6e6c338 body=c888f94 -->
|
||||
public async Task<Section?> InsertOneSection(Section section)
|
||||
{
|
||||
try
|
||||
@@ -151,6 +162,7 @@ public class SectionRepository : MongoRepository<Section>, ISectionRepository
|
||||
/// </summary>
|
||||
/// <param name="section">The section containing the identifier of the record to update and the new field values to persist.</param>
|
||||
/// <returns>The updated <see cref="Section"/> as it appears after the update, or <see langword="null"/> if no matching record was found.</returns>
|
||||
/// <!-- aidoc:v1 sig=21df1de body=d447f33 -->
|
||||
public async Task<Section?> UpdateSection(Section section)
|
||||
{
|
||||
var filter = Builders<Section>.Filter.Eq("Id", section.Id);
|
||||
|
||||
Reference in New Issue
Block a user