=== 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:
julian
2026-06-28 02:50:05 -07:00
parent a19fb90902
commit 586f02a2ca
654 changed files with 5260 additions and 0 deletions
@@ -13,6 +13,7 @@ namespace adas_core.Infrastructure.Repositories;
/// Repository implementation for managing Notice entities in MongoDB.
/// Provides CRUD operations for notices/notifications that can be displayed on screens.
/// </summary>
/// <!-- aidoc:v1 sig=a7dc3b2 -->
public class NoticeRepository : MongoRepository<Notice>, INoticeRepository
{
private readonly ApiSettings _apiSettings;
@@ -23,6 +24,7 @@ public class NoticeRepository : MongoRepository<Notice>, INoticeRepository
/// <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=c18eb8b body=99d85d9 -->
public NoticeRepository(IOptions<ApiSettings>? apiSettings, IMongoDatabase database) : base(database)
{
if (apiSettings != null)
@@ -35,6 +37,7 @@ public class NoticeRepository : MongoRepository<Notice>, INoticeRepository
/// Gets the name of the collection for notices.
/// </summary>
/// <returns>The collection name from API settings.</returns>
/// <!-- aidoc:v1 sig=94e22ff body=dfe078b -->
public override string GetCollectionName()
{
return _apiSettings.Notices;
@@ -46,6 +49,8 @@ public class NoticeRepository : MongoRepository<Notice>, INoticeRepository
/// </summary>
/// <param name="notice">The Notice entity to insert.</param>
/// <exception cref="Exception">Logs warning and silently fails on insertion error.</exception>
/// <!-- aidoc-review:v1 severity=medium kind=extra_exception
/// "The method catches Exception and does not re-throw it, so documenting <exception cref=\"Exception\"> is misleading—callers will not see this exception propagate." -->
public override async Task InsertOneAsync(Notice notice)
{
try
@@ -64,6 +69,7 @@ public class NoticeRepository : MongoRepository<Notice>, INoticeRepository
/// </summary>
/// <param name="id">The ObjectId of the notice to delete.</param>
/// <exception cref="Exception">Throws and re-throws exceptions after logging.</exception>
/// <!-- aidoc:v1 sig=3de1ad6 body=c1d807b -->
public async Task Delete(ObjectId id)
{
try
@@ -83,6 +89,7 @@ public class NoticeRepository : MongoRepository<Notice>, INoticeRepository
/// </summary>
/// <param name="notice">The Notice entity with updated values.</param>
/// <exception cref="Exception">Throws and re-throws exceptions after logging.</exception>
/// <!-- aidoc:v1 sig=64f77d8 body=b33b6f7 -->
public async Task Update(Notice notice)
{
try
@@ -101,6 +108,8 @@ public class NoticeRepository : MongoRepository<Notice>, INoticeRepository
/// </summary>
/// <returns>An enumerable of all Notice entities.</returns>
/// <exception cref="Exception">Logs errors and returns empty list on failure.</exception>
/// <!-- aidoc-review:v1 severity=medium kind=extra_exception
/// "The method catches and handles all exceptions internally (returns empty list), so no exception is propagated to the caller; documenting <exception cref=\"Exception\"> is misleading." -->
public async Task<IEnumerable<Notice>> FindAll()
{
try
@@ -121,6 +130,8 @@ public class NoticeRepository : MongoRepository<Notice>, INoticeRepository
/// <param name="id">The ObjectId of the notice to retrieve.</param>
/// <returns>The Notice if found; otherwise, null.</returns>
/// <exception cref="Exception">Logs errors and returns null on failure.</exception>
/// <!-- aidoc-review:v1 severity=medium kind=extra_exception
/// "The method's try-catch handles all exceptions internally and returns null, so no exception is ever propagated to the caller; documenting <exception cref=\"Exception\"> is misleading." -->
public async Task<Notice?> FindById(ObjectId id)
{
try
@@ -143,6 +154,8 @@ public class NoticeRepository : MongoRepository<Notice>, INoticeRepository
/// <param name="date">The date to filter notices by.</param>
/// <returns>An enumerable of Notice entities matching the date, or null on error.</returns>
/// <exception cref="Exception">Logs errors and returns null on failure.</exception>
/// <!-- aidoc-review:v1 severity=medium kind=extra_exception
/// "The <exception cref=\"Exception\"> tag documents an exception that is never thrown to callers; the catch block handles all exceptions internally and returns null instead." -->
public async Task<IEnumerable<Notice>?> FindByDate(DateTime date)
{
try
@@ -165,6 +178,7 @@ public class NoticeRepository : MongoRepository<Notice>, INoticeRepository
/// <param name="type">The notice type to filter by.</param>
/// <returns>An enumerable of Notice entities matching the type, or null on error.</returns>
/// <exception cref="Exception">Logs errors and returns null on failure.</exception>
/// <!-- aidoc:v1 sig=c8e3fb2 body=d0629e2 -->
public async Task<IEnumerable<Notice>?> FindByType(string type)
{
try
@@ -187,6 +201,7 @@ public class NoticeRepository : MongoRepository<Notice>, INoticeRepository
/// <param name="displayId">The ObjectId of the display to filter by.</param>
/// <returns>An enumerable of Notice entities for the display, or null on error.</returns>
/// <exception cref="Exception">Logs errors and returns null on failure.</exception>
/// <!-- aidoc:v1 sig=a6848c6 body=c64a895 -->
public async Task<IEnumerable<Notice>?> FindByDisplayId(ObjectId displayId)
{
try
@@ -207,6 +222,8 @@ public class NoticeRepository : MongoRepository<Notice>, INoticeRepository
/// Creates the necessary indexes for the Notice collection.
/// Creates compound indexes on (noticeType, noticeDate) and (noticeDate) for improved query performance.
/// </summary>
/// <!-- aidoc-review:v1 severity=low kind=wrong_summary
/// "Documentation states 'compound indexes' (plural), but only (noticeType, noticeDate) is compound; (noticeDate) is a single-field index." -->
public override async Task CreateIndexes()
{
var options = new CreateIndexOptions { Background = true, Unique = false };