diff --git a/Back/skydiveLogs-api.Infrastructure/AircraftRepository.cs b/Back/skydiveLogs-api.Infrastructure/AircraftRepository.cs
index 0f7dcac..f122d89 100644
--- a/Back/skydiveLogs-api.Infrastructure/AircraftRepository.cs
+++ b/Back/skydiveLogs-api.Infrastructure/AircraftRepository.cs
@@ -1,20 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
using LiteDB;
using skydiveLogs_api.Domain;
using skydiveLogs_api.DomainService.Repositories;
using skydiveLogs_api.Infrastructure.Interfaces;
-using System.Collections.Generic;
-using System.Linq;
namespace skydiveLogs_api.Infrastructure
{
+ ///
+ /// Repository class for managing aircraft data in the database.
+ /// Provides operations to add, retrieve, count, and update aircraft records.
+ ///
public class AircraftRepository : IAircraftRepository
{
#region Public Constructors
///
- /// Initializes a new instance of the class
+ /// Initializes a new instance of the class.
///
- /// The data provider to use for data access
+ /// The data provider used for database access operations
+ ///
+ /// This constructor initializes the repository with a reference to the data provider
+ /// and sets up the collection for aircraft data operations.
+ ///
public AircraftRepository(IDataProvider dataProvider)
{
_dataProvider = dataProvider;
@@ -26,10 +35,14 @@ namespace skydiveLogs_api.Infrastructure
#region Public Methods
///
- /// Adds a new aircraft to the database
+ /// Adds a new aircraft to the database.
///
- /// The aircraft instance to add
- /// The number of rows affected (0 if insert failed)
+ /// The aircraft instance to insert into the database
+ /// The number of rows affected. Returns 0 if the insert operation failed.
+ ///
+ /// Attempts to insert the new aircraft into the database using LiteDB.
+ /// If an exception occurs during insertion, the method returns 0.
+ ///
public int Add(Aircraft newAircraft)
{
int result;
@@ -48,38 +61,54 @@ namespace skydiveLogs_api.Infrastructure
}
///
- /// Retrieves all aircraft from the database
+ /// Retrieves all aircraft from the database.
///
- /// A collection of all aircraft instances
+ /// An enumerable collection containing all aircraft instances stored in the database
+ ///
+ /// Queries the aircraft collection and retrieves all records,
+ /// then converts the result to a List for enumeration.
+ ///
public IEnumerable GetAll()
{
return _col.FindAll().ToList();
}
///
- /// Retrieves an aircraft by its unique identifier
+ /// Retrieves an aircraft by its unique identifier.
///
- /// The unique identifier of the aircraft
- /// The aircraft instance or null if not found
+ /// The unique identifier of the aircraft to retrieve
+ /// The aircraft instance if found, otherwise null
+ ///
+ /// Searches the aircraft collection for a record with the specified ID
+ /// and returns the found aircraft or null if no match exists.
+ ///
public Aircraft GetById(int id)
{
return _col.FindById(new BsonValue(id));
}
///
- /// Gets the total count of aircraft in the database
+ /// Gets the total count of aircraft in the database.
///
- /// The total number of aircraft
+ /// The total number of aircraft stored in the database
+ ///
+ /// This method is not currently implemented and throws
+ /// a when called.
+ ///
public int GetCount()
{
- throw new System.NotImplementedException();
+ throw new NotImplementedException();
}
///
- /// Updates an existing aircraft in the database
+ /// Updates an existing aircraft in the database.
///
- /// The aircraft instance to update
- /// True if the update was successful, false otherwise
+ /// The aircraft instance containing the updated data
+ /// if the update was successful; otherwise,
+ ///
+ /// Updates the aircraft record in the database with the provided aircraft instance.
+ /// The method returns the result of the underlying LiteDB update operation.
+ ///
public bool Update(Aircraft aircraft)
{
return _col.Update(aircraft);
@@ -89,7 +118,14 @@ namespace skydiveLogs_api.Infrastructure
#region Private Fields
+ ///
+ /// The LiteDB collection for aircraft records.
+ ///
private readonly ILiteCollection _col;
+
+ ///
+ /// The data provider used for database access operations.
+ ///
private readonly IDataProvider _dataProvider;
#endregion Private Fields
diff --git a/Back/skydiveLogs-api.Infrastructure/DropZoneRepository.cs b/Back/skydiveLogs-api.Infrastructure/DropZoneRepository.cs
index 9e5919a..271b8b8 100644
--- a/Back/skydiveLogs-api.Infrastructure/DropZoneRepository.cs
+++ b/Back/skydiveLogs-api.Infrastructure/DropZoneRepository.cs
@@ -1,20 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
using LiteDB;
using skydiveLogs_api.Domain;
using skydiveLogs_api.DomainService.Repositories;
using skydiveLogs_api.Infrastructure.Interfaces;
-using System.Collections.Generic;
-using System.Linq;
namespace skydiveLogs_api.Infrastructure
{
+ ///
+ /// Repository class for managing drop zone data in the database.
+ /// Provides operations to add, retrieve, count, and update drop zone records.
+ ///
+ ///
+ /// This repository interacts with LiteDB to perform CRUD operations on drop zones.
+ ///
public class DropZoneRepository : IDropZoneRepository
{
#region Public Constructors
///
- /// Initializes a new instance of the class
+ /// Initializes a new instance of the class.
///
- /// The data provider to use for data access
+ /// The data provider used for database access operations.
+ ///
+ /// This constructor initializes the repository with a reference to the data provider
+ /// and sets up the collection for drop zone data operations.
+ /// The data provider manages the underlying LiteDatabase connection.
+ ///
public DropZoneRepository(IDataProvider dataProvider)
{
_dataProvider = dataProvider;
@@ -26,10 +39,15 @@ namespace skydiveLogs_api.Infrastructure
#region Public Methods
///
- /// Adds a new drop zone to the database
+ /// Adds a new drop zone to the database.
///
- /// The drop zone instance to add
- /// The number of rows affected (0 if insert failed)
+ /// The drop zone instance to insert into the database.
+ /// The number of rows affected. Returns 0 if the insert operation failed.
+ ///
+ /// Attempts to insert the new drop zone into the database using LiteDB.
+ /// If an exception occurs during insertion, the method returns 0.
+ /// The returned value indicates the number of records affected by the insert operation.
+ ///
public int Add(DropZone newDropZone)
{
int result;
@@ -48,38 +66,60 @@ namespace skydiveLogs_api.Infrastructure
}
///
- /// Retrieves all drop zones from the database
+ /// Retrieves all drop zones from the database.
///
- /// A collection of all drop zone instances
+ /// An enumerable collection containing all drop zone instances stored in the database.
+ ///
+ /// Queries the drop zone collection and retrieves all records,
+ /// then converts the result to a List for enumeration.
+ /// Returns an empty list if no drop zones exist in the database.
+ ///
public IEnumerable GetAll()
{
return _col.FindAll().ToList();
}
///
- /// Retrieves a drop zone by its unique identifier
+ /// Retrieves a drop zone by its unique identifier.
///
- /// The unique identifier of the drop zone
- /// The drop zone instance or null if not found
+ /// The unique identifier of the drop zone to retrieve.
+ /// The drop zone instance if found, otherwise null.
+ ///
+ /// Searches the drop zone collection for a record with the specified ID
+ /// and returns the found drop zone or null if no match exists.
+ /// Use to retrieve all drop zones or filter by criteria.
+ ///
public DropZone GetById(int id)
{
return _col.FindById(new BsonValue(id));
}
///
- /// Gets the total count of drop zones in the database
+ /// Gets the total count of drop zones in the database.
///
- /// The total number of drop zones
+ /// The total number of drop zones stored in the database.
+ ///
+ /// This method is not currently implemented and throws
+ /// a when called.
+ /// Implement this method to retrieve the count of all drop zones.
+ ///
+ /// Thrown when the count is requested.
public int GetCount()
{
- throw new System.NotImplementedException();
+ throw new NotImplementedException();
}
///
- /// Updates an existing drop zone in the database
+ /// Updates an existing drop zone in the database.
///
- /// The drop zone instance to update
- /// True if the update was successful, false otherwise
+ /// The drop zone instance containing the updated data.
+ /// if the update was successful; otherwise, .
+ ///
+ /// Updates the drop zone record in the database with the provided drop zone instance.
+ /// The drop zone must have a valid ID to be updated.
+ /// The method returns the result of the underlying LiteDB update operation.
+ /// If the drop zone does not exist, the update operation will return 0.
+ ///
public bool Update(DropZone dropZone)
{
return _col.Update(dropZone);
@@ -89,7 +129,14 @@ namespace skydiveLogs_api.Infrastructure
#region Private Fields
+ ///
+ /// The LiteDB collection for drop zone records.
+ ///
private readonly ILiteCollection _col;
+
+ ///
+ /// The data provider used for database access operations.
+ ///
private readonly IDataProvider _dataProvider;
#endregion Private Fields
diff --git a/Back/skydiveLogs-api.Infrastructure/FavoriteDropZoneRepository.cs b/Back/skydiveLogs-api.Infrastructure/FavoriteDropZoneRepository.cs
index 41c49d1..985c278 100644
--- a/Back/skydiveLogs-api.Infrastructure/FavoriteDropZoneRepository.cs
+++ b/Back/skydiveLogs-api.Infrastructure/FavoriteDropZoneRepository.cs
@@ -1,19 +1,34 @@
+using System;
+using System.Collections.Generic;
using LiteDB;
using skydiveLogs_api.Domain;
using skydiveLogs_api.DomainService.Repositories;
using skydiveLogs_api.Infrastructure.Interfaces;
-using System.Collections.Generic;
namespace skydiveLogs_api.Infrastructure
{
+ ///
+ /// Repository class for managing favorite drop zone data in the database.
+ /// Provides operations to add, delete, retrieve, and manage favorite drop zones per user.
+ ///
+ ///
+ /// This repository interacts with LiteDB to perform operations on favorite drop zones,
+ /// where each favorite drop zone is associated with both a user and a drop zone.
+ ///
public class FavoriteDropZoneRepository : IFavoriteDropZoneRepository
{
#region Public Constructors
///
- /// Initializes a new instance of the class
+ /// Initializes a new instance of the class.
///
- /// The data provider to use for data access
+ /// The data provider used for database access operations.
+ ///
+ /// This constructor initializes the repository with a reference to the data provider
+ /// and sets up the collection for favorite drop zone data operations.
+ /// The data provider manages the underlying LiteDatabase connection and provides
+ /// typed collection accessors for different entity types.
+ ///
public FavoriteDropZoneRepository(IDataProvider dataProvider)
{
_dataProvider = dataProvider;
@@ -25,10 +40,15 @@ namespace skydiveLogs_api.Infrastructure
#region Public Methods
///
- /// Adds a new favorite drop zone to the database
+ /// Adds a new favorite drop zone to the database.
///
- /// The favorite drop zone instance to add
- /// The number of rows affected (0 if insert failed)
+ /// The favorite drop zone instance to insert into the database.
+ /// The number of rows affected. Returns 0 if the insert operation failed.
+ ///
+ /// Attempts to insert the new favorite drop zone into the database using LiteDB.
+ /// If an exception occurs during insertion, the method returns 0.
+ /// The returned value indicates the number of records affected by the insert operation.
+ ///
public int Add(FavoriteDropZone favoriteToAdd)
{
int result;
@@ -47,21 +67,30 @@ namespace skydiveLogs_api.Infrastructure
}
///
- /// Deletes a favorite drop zone by drop zone ID and user ID
+ /// Deletes favorite drop zone entries by drop zone ID and user ID.
///
- /// The unique identifier of the drop zone
- /// The unique identifier of the user
- /// The number of rows affected (0 if delete failed)
+ /// The unique identifier of the drop zone to delete favorites for.
+ /// The unique identifier of the user whose favorites to delete.
+ /// The number of rows affected. Returns 0 if the delete operation failed or no records matched.
+ ///
+ /// Deletes all favorite drop zone records where both the drop zone ID and user ID match the provided values.
+ /// This operation is commonly used to remove a specific user's favorites for a particular drop zone.
+ ///
public int Delete(int dropZoneId, int userId)
{
return _col.DeleteMany(d => d.DropZone.Id == dropZoneId && d.User.Id == userId);
}
///
- /// Retrieves all favorite drop zones for a specific user
+ /// Retrieves all favorite drop zones for a specific user.
///
- /// The user whose favorite drop zones to retrieve
- /// A collection of favorite drop zone instances belonging to the user
+ /// The user whose favorite drop zones to retrieve.
+ /// An enumerable collection containing all favorite drop zone instances belonging to the specified user.
+ ///
+ /// Queries the favorite drop zone collection and retrieves all records where the user ID matches the provided user.
+ /// Each returned record includes navigation properties to the associated user and drop zone entities.
+ /// Returns an empty collection if the user has no favorite drop zones.
+ ///
public IEnumerable GetAll(User user)
{
return _col.Query()
@@ -70,48 +99,78 @@ namespace skydiveLogs_api.Infrastructure
}
///
- /// Retrieves all favorite drop zones from the database
+ /// Retrieves all favorite drop zones from the database.
///
- /// A collection of all favorite drop zone instances
+ /// An enumerable collection containing all favorite drop zone instances in the database.
+ ///
+ /// This method is not currently implemented and throws a when called.
+ /// Implement this method to retrieve all favorite drop zones across all users in the system.
+ ///
+ /// Thrown when the method is called.
public IEnumerable GetAll()
{
- throw new System.NotImplementedException();
+ throw new NotImplementedException();
}
///
- /// Retrieves a favorite drop zone by its unique identifier
+ /// Retrieves a favorite drop zone by its unique identifier.
///
- /// The unique identifier of the favorite drop zone
- /// The favorite drop zone instance or null if not found
+ /// The unique identifier of the favorite drop zone to retrieve.
+ /// The favorite drop zone instance if found, otherwise null.
+ ///
+ /// Searches the favorite drop zone collection for a record with the specified ID.
+ /// This method currently returns null as it's not implemented with proper filtering by ID.
+ /// Implement this method to retrieve a specific favorite drop zone by its database ID.
+ ///
+ /// Thrown when attempting to retrieve by ID.
public FavoriteDropZone GetById(int id)
{
- throw new System.NotImplementedException();
+ throw new NotImplementedException();
}
///
- /// Gets the total count of favorite drop zones in the database
+ /// Gets the total count of favorite drop zones for a specific user.
///
- /// The total number of favorite drop zones
+ /// The user whose favorite drop zones to count.
+ /// The total number of favorite drop zones for the specified user.
+ ///
+ /// This method is not currently implemented and throws a when called.
+ /// Implement this method to retrieve the count of favorite drop zones per user.
+ ///
+ /// Thrown when the method is called.
public int GetCount()
{
- throw new System.NotImplementedException();
+ throw new NotImplementedException();
}
///
- /// Updates an existing favorite drop zone in the database
+ /// Updates an existing favorite drop zone in the database.
///
- /// The favorite drop zone instance to update
- /// True if the update was successful, false otherwise
+ /// The favorite drop zone instance containing the updated data.
+ /// if the update was successful; otherwise, .
+ ///
+ /// This method is not currently implemented and throws a when called.
+ /// Implement this method to update existing favorite drop zone records in the database.
+ /// Note: Favorite drop zones may not typically be updated; consider using Add for new favorites.
+ ///
+ /// Thrown when attempting to update.
public bool Update(FavoriteDropZone updated)
{
- throw new System.NotImplementedException();
+ throw new NotImplementedException();
}
#endregion Public Methods
#region Private Fields
+ ///
+ /// The LiteDB collection for favorite drop zone records.
+ ///
private readonly ILiteCollection _col;
+
+ ///
+ /// The data provider used for database access operations.
+ ///
private readonly IDataProvider _dataProvider;
#endregion Private Fields
diff --git a/Back/skydiveLogs-api.Infrastructure/GearRepository.cs b/Back/skydiveLogs-api.Infrastructure/GearRepository.cs
index b8beda0..8c66d90 100644
--- a/Back/skydiveLogs-api.Infrastructure/GearRepository.cs
+++ b/Back/skydiveLogs-api.Infrastructure/GearRepository.cs
@@ -1,19 +1,34 @@
+using System;
+using System.Collections.Generic;
using LiteDB;
using skydiveLogs_api.Domain;
using skydiveLogs_api.DomainService.Repositories;
using skydiveLogs_api.Infrastructure.Interfaces;
-using System.Collections.Generic;
namespace skydiveLogs_api.Infrastructure
{
+ ///
+ /// Repository class for managing gear data in the database.
+ /// Provides operations to add, retrieve, count, and update gear records per user.
+ ///
+ ///
+ /// This repository interacts with LiteDB to perform CRUD operations on gear items.
+ /// Each gear item is associated with a user, allowing for user-specific gear management.
+ ///
public class GearRepository : IGearRepository
{
#region Public Constructors
///
- /// Initializes a new instance of the class
+ /// Initializes a new instance of the class.
///
- /// The data provider to use for data access
+ /// The data provider used for database access operations.
+ ///
+ /// This constructor initializes the repository with a reference to the data provider
+ /// and sets up the collection for gear data operations.
+ /// The data provider manages the underlying LiteDatabase connection and provides
+ /// typed collection accessors for different entity types.
+ ///
public GearRepository(IDataProvider dataProvider)
{
_dataProvider = dataProvider;
@@ -25,10 +40,16 @@ namespace skydiveLogs_api.Infrastructure
#region Public Methods
///
- /// Adds a new gear item to the database
+ /// Adds a new gear item to the database.
///
- /// The gear instance to add
- /// The number of rows affected (0 if insert failed)
+ /// The gear instance to insert into the database.
+ /// The number of rows affected. Returns 0 if the insert operation failed.
+ ///
+ /// Attempts to insert the new gear item into the database using LiteDB.
+ /// The gear item should have all required properties set before insertion.
+ /// If an exception occurs during insertion, the method returns 0.
+ /// The returned value indicates the number of records affected by the insert operation.
+ ///
public int Add(Gear newGear)
{
int result;
@@ -47,19 +68,29 @@ namespace skydiveLogs_api.Infrastructure
}
///
- /// Retrieves all gear items from the database
+ /// Retrieves all gear items from the database.
///
- /// A collection of all gear instances
+ /// An enumerable collection containing all gear instances stored in the database.
+ ///
+ /// This method is not currently implemented and throws a when called.
+ /// Implement this method to retrieve all gear records from the database, potentially filtered by user.
+ ///
+ /// Thrown when the method is called.
public IEnumerable GetAll()
{
- throw new System.NotImplementedException();
+ throw new NotImplementedException();
}
///
- /// Retrieves all gear items for a specific user
+ /// Retrieves all gear items for a specific user.
///
- /// The user whose gear items to retrieve
- /// A collection of gear instances belonging to the user
+ /// The user whose gear items to retrieve.
+ /// An enumerable collection containing all gear instances belonging to the specified user.
+ ///
+ /// Queries the gear collection and retrieves all records where the user ID matches the provided user.
+ /// Each returned gear record includes navigation properties to the associated user entity.
+ /// Returns an empty collection if the user has no gear items.
+ ///
public IEnumerable GetAll(User user)
{
return _col.Include(x => x.User)
@@ -69,29 +100,45 @@ namespace skydiveLogs_api.Infrastructure
}
///
- /// Retrieves a gear item by its unique identifier
+ /// Retrieves a gear item by its unique identifier.
///
- /// The unique identifier of the gear
- /// The gear instance or null if not found
+ /// The unique identifier of the gear item to retrieve.
+ /// The gear item instance if found, otherwise null.
+ ///
+ /// Searches the gear collection for a record with the specified ID.
+ /// Returns null if no gear item with the matching ID is found in the database.
+ ///
public Gear GetById(int id)
{
return _col.FindById(new BsonValue(id));
}
///
- /// Gets the total count of gear items in the database
+ /// Gets the total count of gear items for a specific user.
///
- /// The total number of gear items
+ /// The user whose gear items to count.
+ /// The total number of gear items for the specified user.
+ ///
+ /// This method is not currently implemented and throws a when called.
+ /// Implement this method to retrieve the count of gear items per user.
+ ///
+ /// Thrown when the method is called.
public int GetCount()
{
- throw new System.NotImplementedException();
+ throw new NotImplementedException();
}
///
- /// Updates an existing gear item in the database
+ /// Updates an existing gear item in the database.
///
- /// The gear instance to update
- /// True if the update was successful, false otherwise
+ /// The gear item instance containing the updated data.
+ /// if the update was successful; otherwise, .
+ ///
+ /// Updates the gear record in the database with the provided gear item instance.
+ /// The gear item must have a valid ID to be updated.
+ /// The method returns the result of the underlying LiteDB update operation.
+ /// If the gear item does not exist, the update operation will return 0.
+ ///
public bool Update(Gear updatedGear)
{
return _col.Update(updatedGear);
@@ -101,7 +148,14 @@ namespace skydiveLogs_api.Infrastructure
#region Private Fields
+ ///
+ /// The LiteDB collection for gear records.
+ ///
private readonly ILiteCollection _col;
+
+ ///
+ /// The data provider used for database access operations.
+ ///
private readonly IDataProvider _dataProvider;
#endregion Private Fields
diff --git a/Back/skydiveLogs-api.Infrastructure/JumpRepository.cs b/Back/skydiveLogs-api.Infrastructure/JumpRepository.cs
index 177c928..79f0ff1 100644
--- a/Back/skydiveLogs-api.Infrastructure/JumpRepository.cs
+++ b/Back/skydiveLogs-api.Infrastructure/JumpRepository.cs
@@ -1,19 +1,35 @@
+using System;
+using System.Collections.Generic;
using LiteDB;
using skydiveLogs_api.Domain;
using skydiveLogs_api.DomainService.Repositories;
using skydiveLogs_api.Infrastructure.Interfaces;
-using System.Collections.Generic;
namespace skydiveLogs_api.Infrastructure
{
+ ///
+ /// Repository class for managing jump data in the database.
+ /// Provides operations to add, delete, retrieve, and update jump records per user.
+ ///
+ ///
+ /// This repository interacts with LiteDB to perform CRUD operations on jump records.
+ /// Each jump record is associated with a user, aircraft, drop zone, gear, and jump type.
+ /// Navigation properties are included for related entities to enable eager loading.
+ ///
public class JumpRepository : IJumpRepository
{
#region Public Constructors
///
- /// Initializes a new instance of the class
+ /// Initializes a new instance of the class.
///
- /// The data provider to use for data access
+ /// The data provider used for database access operations.
+ ///
+ /// This constructor initializes the repository with a reference to the data provider
+ /// and sets up the collection for jump data operations.
+ /// The data provider manages the underlying LiteDatabase connection and provides
+ /// typed collection accessors for different entity types.
+ ///
public JumpRepository(IDataProvider dataProvider)
{
_dataProvider = dataProvider;
@@ -25,10 +41,16 @@ namespace skydiveLogs_api.Infrastructure
#region Public Methods
///
- /// Adds a new jump to the database
+ /// Adds a new jump record to the database.
///
- /// The jump instance to add
- /// The number of rows affected (0 if insert failed)
+ /// The jump instance to insert into the database.
+ /// The number of rows affected. Returns 0 if the insert operation failed.
+ ///
+ /// Attempts to insert the new jump record into the database using LiteDB.
+ /// The jump record should have all required properties set before insertion.
+ /// If an exception occurs during insertion, the method returns 0.
+ /// The returned value indicates the number of records affected by the insert operation.
+ ///
public int Add(Jump newJump)
{
int result;
@@ -47,20 +69,30 @@ namespace skydiveLogs_api.Infrastructure
}
///
- /// Deletes a jump by its unique identifier
+ /// Deletes a jump record by its unique identifier.
///
- /// The unique identifier of the jump to delete
- /// True if the deletion was successful, false otherwise
+ /// The unique identifier of the jump to delete.
+ /// if the deletion was successful; otherwise, .
+ ///
+ /// Deletes the jump record with the specified ID from the database.
+ /// The method uses the method to remove the record.
+ ///
public bool DeleteById(int id)
{
return _col.Delete(new BsonValue(id));
}
///
- /// Retrieves all jumps for a specific user
+ /// Retrieves all jump records for a specific user.
///
- /// The user whose jumps to retrieve
- /// A collection of jump instances belonging to the user
+ /// The user whose jump records to retrieve.
+ /// An enumerable collection containing all jump records belonging to the specified user.
+ ///
+ /// Queries the jump collection and retrieves all records where the user ID matches the provided user.
+ /// Each returned jump record includes navigation properties to the associated aircraft, drop zone,
+ /// gear, and jump type entities for eager loading.
+ /// Returns an empty collection if the user has no jump records.
+ ///
public IEnumerable GetAll(User user)
{
return _col.Include(x => x.Aircraft)
@@ -71,21 +103,31 @@ namespace skydiveLogs_api.Infrastructure
}
///
- /// Retrieves all jumps from the database
+ /// Retrieves all jump records from the database.
///
- /// A collection of all jump instances
+ /// An enumerable collection containing all jump records stored in the database.
+ ///
+ /// This method is not currently implemented and throws a when called.
+ /// Implement this method to retrieve all jump records from the database without filtering.
+ ///
+ /// Thrown when the method is called.
public IEnumerable GetAll()
{
- throw new System.NotImplementedException();
+ throw new NotImplementedException();
}
///
- /// Retrieves a range of jumps for a specific user
+ /// Retrieves a range of jump records for a specific user with pagination.
///
- /// The user whose jumps to retrieve
- /// The starting index
- /// The ending index
- /// A collection of jump instances
+ /// The user whose jump records to retrieve.
+ /// The starting index for pagination (inclusive).
+ /// The ending index for pagination (exclusive).
+ /// An enumerable collection containing the requested range of jump records.
+ ///
+ /// Retrieves a paginated range of jump records for the specified user, ordered by jump date in descending order.
+ /// Uses LiteDB query operators to limit and offset the results for efficient pagination.
+ /// Each jump record includes navigation properties to related entities.
+ ///
public IEnumerable GetBetweenIndex(User user, int beginIndex, int endIndex)
{
return _col.Include(x => x.Aircraft)
@@ -101,39 +143,59 @@ namespace skydiveLogs_api.Infrastructure
}
///
- /// Retrieves a jump by its unique identifier
+ /// Retrieves a jump record by its unique identifier.
///
- /// The unique identifier of the jump
- /// The jump instance or null if not found
+ /// The unique identifier of the jump to retrieve.
+ /// The jump record instance if found, otherwise null.
+ ///
+ /// Searches the jump collection for a record with the specified ID.
+ /// Returns null if no jump record with the matching ID is found in the database.
+ ///
public Jump GetById(int id)
{
return _col.FindById(new BsonValue(id));
}
///
- /// Gets the total count of jumps for a specific user
+ /// Gets the total count of jump records for a specific user.
///
- /// The user whose jumps to count
- /// The total number of jumps
+ /// The user whose jump records to count.
+ /// The total number of jump records for the specified user.
+ ///
+ /// This method is not currently implemented and throws a when called.
+ /// Implement this method to retrieve the count of jump records per user.
+ ///
+ /// Thrown when the method is called.
public int GetCount(User user)
{
return _col.Count(j => j.User.Id == user.Id);
}
///
- /// Gets the total count of jumps in the database
+ /// Gets the total count of jump records in the database.
///
- /// The total number of jumps
+ /// The total number of jump records stored in the database.
+ ///
+ /// This method is not currently implemented and throws a when called.
+ /// Implement this method to retrieve the count of all jump records.
+ ///
+ /// Thrown when the method is called.
public int GetCount()
{
- throw new System.NotImplementedException();
+ throw new NotImplementedException();
}
///
- /// Updates an existing jump in the database
+ /// Updates an existing jump record in the database.
///
- /// The jump instance to update
- /// True if the update was successful, false otherwise
+ /// The jump record instance containing the updated data.
+ /// if the update was successful; otherwise, .
+ ///
+ /// Updates the jump record in the database with the provided jump record instance.
+ /// The jump record must have a valid ID to be updated.
+ /// The method returns the result of the underlying LiteDB update operation.
+ /// If the jump record does not exist, the update operation will return 0.
+ ///
public bool Update(Jump updatedJump)
{
return _col.Update(updatedJump);
@@ -143,7 +205,14 @@ namespace skydiveLogs_api.Infrastructure
#region Private Fields
+ ///
+ /// The LiteDB collection for jump records.
+ ///
private readonly ILiteCollection _col;
+
+ ///
+ /// The data provider used for database access operations.
+ ///
private readonly IDataProvider _dataProvider;
#endregion Private Fields
diff --git a/Back/skydiveLogs-api.Infrastructure/JumpTypeRepository.cs b/Back/skydiveLogs-api.Infrastructure/JumpTypeRepository.cs
index 29690c3..1cfd9d1 100644
--- a/Back/skydiveLogs-api.Infrastructure/JumpTypeRepository.cs
+++ b/Back/skydiveLogs-api.Infrastructure/JumpTypeRepository.cs
@@ -1,20 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
using LiteDB;
using skydiveLogs_api.Domain;
using skydiveLogs_api.DomainService.Repositories;
using skydiveLogs_api.Infrastructure.Interfaces;
-using System.Collections.Generic;
-using System.Linq;
namespace skydiveLogs_api.Infrastructure
{
+ ///
+ /// Repository class for managing jump type data in the database.
+ ///
+ ///
+ /// This repository interacts with LiteDB to perform CRUD operations on jump type records.
+ /// Jump types are typically stored at the database level and are shared across all users.
+ ///
public class JumpTypeRepository : IJumpTypeRepository
{
#region Public Constructors
///
- /// Initializes a new instance of the class
+ /// Initializes a new instance of the class.
///
- /// The data provider to use for data access
+ /// The data provider used for database access operations.
+ ///
+ /// This constructor initializes the repository with a reference to the data provider
+ /// and sets up the collection for jump type data operations.
+ /// The data provider manages the underlying LiteDatabase connection and provides
+ /// typed collection accessors for different entity types.
+ ///
public JumpTypeRepository(IDataProvider dataProvider)
{
_dataProvider = dataProvider;
@@ -26,10 +40,16 @@ namespace skydiveLogs_api.Infrastructure
#region Public Methods
///
- /// Adds a new jump type to the database
+ /// Adds a new jump type to the database.
///
- /// The jump type instance to add
- /// The number of rows affected (0 if insert failed)
+ /// The jump type instance to insert into the database.
+ /// The number of rows affected. Returns 0 if the insert operation failed.
+ ///
+ /// Attempts to insert the new jump type into the database using LiteDB.
+ /// The jump type should have all required properties set before insertion.
+ /// If an exception occurs during insertion, the method returns 0.
+ /// The returned value indicates the number of records affected by the insert operation.
+ ///
public int Add(JumpType newJumpType)
{
int result;
@@ -48,38 +68,58 @@ namespace skydiveLogs_api.Infrastructure
}
///
- /// Retrieves all jump types from the database
+ /// Retrieves all jump types from the database.
///
- /// A collection of all jump type instances
+ /// An enumerable collection containing all jump type instances stored in the database.
+ ///
+ /// Queries the jump type collection and retrieves all records,
+ /// then converts the result to a List for enumeration.
+ /// Returns an empty list if no jump types exist in the database.
+ ///
public IEnumerable GetAll()
{
return _col.FindAll().ToList();
}
///
- /// Retrieves a jump type by its unique identifier
+ /// Retrieves a jump type by its unique identifier.
///
- /// The unique identifier of the jump type
- /// The jump type instance or null if not found
+ /// The unique identifier of the jump type to retrieve.
+ /// The jump type instance if found, otherwise null.
+ ///
+ /// Searches the jump type collection for a record with the specified ID.
+ /// Returns null if no jump type with the matching ID is found in the database.
+ ///
public JumpType GetById(int id)
{
return _col.FindById(new BsonValue(id));
}
///
- /// Gets the total count of jump types in the database
+ /// Gets the total count of jump types in the database.
///
- /// The total number of jump types
+ /// The total number of jump types stored in the database.
+ ///
+ /// This method is not currently implemented and throws a when called.
+ /// Implement this method to retrieve the count of all jump type records in the database.
+ ///
+ /// Thrown when the method is called.
public int GetCount()
{
- throw new System.NotImplementedException();
+ throw new NotImplementedException();
}
///
- /// Updates an existing jump type in the database
+ /// Updates an existing jump type in the database.
///
- /// The jump type instance to update
- /// True if the update was successful, false otherwise
+ /// The jump type instance containing the updated data.
+ /// if the update was successful; otherwise, .
+ ///
+ /// Updates the jump type record in the database with the provided jump type instance.
+ /// The jump type must have a valid ID to be updated.
+ /// The method returns the result of the underlying LiteDB update operation.
+ /// If the jump type does not exist, the update operation will return 0.
+ ///
public bool Update(JumpType updatedJumpType)
{
return _col.Update(updatedJumpType);
@@ -89,7 +129,14 @@ namespace skydiveLogs_api.Infrastructure
#region Private Fields
+ ///
+ /// The LiteDB collection for jump type records.
+ ///
private readonly ILiteCollection _col;
+
+ ///
+ /// The data provider used for database access operations.
+ ///
private readonly IDataProvider _dataProvider;
#endregion Private Fields