=== 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
@@ -11,6 +11,7 @@ namespace adas_core.Infrastructure.Repositories;
/// <summary>
/// Repository for managing Device entities in MongoDB. Provides methods for finding devices by various attributes and updating device statistics.
/// </summary>
/// <!-- aidoc:v1 sig=8160c8b -->
public class DeviceRepository : MongoRepository<Device>, IDeviceRepository
{
private readonly ApiSettings _apiSettings;
@@ -20,6 +21,7 @@ public class DeviceRepository : MongoRepository<Device>, IDeviceRepository
/// </summary>
/// <param name="apiSettings">The API settings.</param>
/// <param name="database">The MongoDB database.</param>
/// <!-- aidoc:v1 sig=8e9392d body=d58addb -->
public DeviceRepository(ApiSettings apiSettings, IMongoDatabase database) : base(database)
{
_apiSettings = apiSettings;
@@ -29,6 +31,7 @@ public class DeviceRepository : MongoRepository<Device>, IDeviceRepository
/// Gets the name of the MongoDB collection for devices. The collection name is determined by the API settings, with a default value of "devices" if not specified.
/// </summary>
/// <returns>The name of the MongoDB collection for devices.</returns>
/// <!-- aidoc:v1 sig=94e22ff body=8a1ceb4 -->
public override string GetCollectionName()
{
return _apiSettings.Devices ?? "devices";
@@ -40,6 +43,7 @@ public class DeviceRepository : MongoRepository<Device>, IDeviceRepository
/// The MacAddr index is unique, while the others are non-unique and created in the background.
/// </summary>
/// <returns>A task representing the asynchronous operation.</returns>
/// <!-- aidoc:v1 sig=4955da2 body=5d6df8e -->
public override async Task CreateIndexes()
{
var options = new CreateIndexOptions { Background = true, Unique = true };
@@ -59,6 +63,7 @@ public class DeviceRepository : MongoRepository<Device>, IDeviceRepository
/// </summary>
/// <param name="deviceDtoMacAddr">The MAC address of the device to find.</param>
/// <returns>The device with the specified MAC address, or null if not found.</returns>
/// <!-- aidoc:v1 sig=e831bcc body=02399ff -->
public async Task<Device?> FindByMacAddr(string deviceDtoMacAddr)
{
return await Collection
@@ -71,6 +76,7 @@ public class DeviceRepository : MongoRepository<Device>, IDeviceRepository
/// </summary>
/// <param name="deviceDtoSerialNumber">The serial number of the device to find.</param>
/// <returns>The device with the specified serial number, or null if not found.</returns>
/// <!-- aidoc:v1 sig=d482bd7 body=6f0ac54 -->
public async Task<Device?> FindBySerialNumber(string deviceDtoSerialNumber)
{
return await Collection
@@ -83,6 +89,7 @@ public class DeviceRepository : MongoRepository<Device>, IDeviceRepository
/// </summary>
/// <param name="deviceDtoUuid">The UUID of the device to find.</param>
/// <returns>The device with the specified UUID, or null if not found.</returns>
/// <!-- aidoc:v1 sig=af1665c body=db4fc30 -->
public async Task<Device?> FindByUuid(string deviceDtoUuid)
{
return await Collection
@@ -95,6 +102,7 @@ public class DeviceRepository : MongoRepository<Device>, IDeviceRepository
/// </summary>
/// <param name="deviceDtoKey">The key of the device to find.</param>
/// <returns>The device with the specified key, or null if not found.</returns>
/// <!-- aidoc:v1 sig=a1e1740 body=65c4079 -->
public async Task<Device?> FindByKey(string deviceDtoKey)
{
return await Collection
@@ -109,6 +117,7 @@ public class DeviceRepository : MongoRepository<Device>, IDeviceRepository
/// <param name="id">The ID of the device to update.</param>
/// <param name="deviceExist">The existing DeviceDto object containing the updated statistics.</param>
/// <returns>A task representing the asynchronous operation.</returns>
/// <!-- aidoc:v1 sig=0207e01 body=4ce9194 -->
public async Task UpdateDeviceStats(ObjectId id, DeviceDto deviceExist)
{
var update = Builders<Device>.Update