Add comment by AI

This commit is contained in:
2026-04-17 17:26:20 +02:00
parent 61ed4bc223
commit b03085acbe
7 changed files with 251 additions and 18 deletions
@@ -1,4 +1,4 @@
using LiteDB;
using LiteDB;
using skydiveLogs_api.Domain;
using skydiveLogs_api.DomainService.Repositories;
using skydiveLogs_api.Infrastructure.Interfaces;
@@ -10,6 +10,10 @@ namespace skydiveLogs_api.Infrastructure
{
#region Public Constructors
/// <summary>
/// Initializes a new instance of the <see cref="GearRepository"/> class
/// </summary>
/// <param name="dataProvider">The data provider to use for data access</param>
public GearRepository(IDataProvider dataProvider)
{
_dataProvider = dataProvider;
@@ -20,6 +24,11 @@ namespace skydiveLogs_api.Infrastructure
#region Public Methods
/// <summary>
/// Adds a new gear item to the database
/// </summary>
/// <param name="newGear">The gear instance to add</param>
/// <returns>The number of rows affected (0 if insert failed)</returns>
public int Add(Gear newGear)
{
int result;
@@ -37,11 +46,20 @@ namespace skydiveLogs_api.Infrastructure
return result;
}
/// <summary>
/// Retrieves all gear items from the database
/// </summary>
/// <returns>A collection of all gear instances</returns>
public IEnumerable<Gear> GetAll()
{
throw new System.NotImplementedException();
}
/// <summary>
/// Retrieves all gear items for a specific user
/// </summary>
/// <param name="user">The user whose gear items to retrieve</param>
/// <returns>A collection of gear instances belonging to the user</returns>
public IEnumerable<Gear> GetAll(User user)
{
return _col.Include(x => x.User)
@@ -50,16 +68,30 @@ namespace skydiveLogs_api.Infrastructure
.ToList();
}
/// <summary>
/// Retrieves a gear item by its unique identifier
/// </summary>
/// <param name="id">The unique identifier of the gear</param>
/// <returns>The gear instance or null if not found</returns>
public Gear GetById(int id)
{
return _col.FindById(new BsonValue(id));
}
/// <summary>
/// Gets the total count of gear items in the database
/// </summary>
/// <returns>The total number of gear items</returns>
public int GetCount()
{
throw new System.NotImplementedException();
}
/// <summary>
/// Updates an existing gear item in the database
/// </summary>
/// <param name="updatedGear">The gear instance to update</param>
/// <returns>True if the update was successful, false otherwise</returns>
public bool Update(Gear updatedGear)
{
return _col.Update(updatedGear);
@@ -74,4 +106,4 @@ namespace skydiveLogs_api.Infrastructure
#endregion Private Fields
}
}
}