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="FavoriteDropZoneRepository"/> class
/// </summary>
/// <param name="dataProvider">The data provider to use for data access</param>
public FavoriteDropZoneRepository(IDataProvider dataProvider)
{
_dataProvider = dataProvider;
@@ -20,6 +24,11 @@ namespace skydiveLogs_api.Infrastructure
#region Public Methods
/// <summary>
/// Adds a new favorite drop zone to the database
/// </summary>
/// <param name="favoriteToAdd">The favorite drop zone instance to add</param>
/// <returns>The number of rows affected (0 if insert failed)</returns>
public int Add(FavoriteDropZone favoriteToAdd)
{
int result;
@@ -37,11 +46,22 @@ namespace skydiveLogs_api.Infrastructure
return result;
}
/// <summary>
/// Deletes a favorite drop zone by drop zone ID and user ID
/// </summary>
/// <param name="dropZoneId">The unique identifier of the drop zone</param>
/// <param name="userId">The unique identifier of the user</param>
/// <returns>The number of rows affected (0 if delete failed)</returns>
public int Delete(int dropZoneId, int userId)
{
return _col.DeleteMany(d => d.DropZone.Id == dropZoneId && d.User.Id == userId);
}
/// <summary>
/// Retrieves all favorite drop zones for a specific user
/// </summary>
/// <param name="user">The user whose favorite drop zones to retrieve</param>
/// <returns>A collection of favorite drop zone instances belonging to the user</returns>
public IEnumerable<FavoriteDropZone> GetAll(User user)
{
return _col.Query()
@@ -49,21 +69,39 @@ namespace skydiveLogs_api.Infrastructure
.ToList();
}
/// <summary>
/// Retrieves all favorite drop zones from the database
/// </summary>
/// <returns>A collection of all favorite drop zone instances</returns>
public IEnumerable<FavoriteDropZone> GetAll()
{
throw new System.NotImplementedException();
}
/// <summary>
/// Retrieves a favorite drop zone by its unique identifier
/// </summary>
/// <param name="id">The unique identifier of the favorite drop zone</param>
/// <returns>The favorite drop zone instance or null if not found</returns>
public FavoriteDropZone GetById(int id)
{
throw new System.NotImplementedException();
}
/// <summary>
/// Gets the total count of favorite drop zones in the database
/// </summary>
/// <returns>The total number of favorite drop zones</returns>
public int GetCount()
{
throw new System.NotImplementedException();
}
/// <summary>
/// Updates an existing favorite drop zone in the database
/// </summary>
/// <param name="updated">The favorite drop zone instance to update</param>
/// <returns>True if the update was successful, false otherwise</returns>
public bool Update(FavoriteDropZone updated)
{
throw new System.NotImplementedException();
@@ -78,4 +116,4 @@ namespace skydiveLogs_api.Infrastructure
#endregion Private Fields
}
}
}