diff --git a/Back/skydiveLogs-api.Infrastructure/AircraftRepository.cs b/Back/skydiveLogs-api.Infrastructure/AircraftRepository.cs index ab54476..0f7dcac 100644 --- a/Back/skydiveLogs-api.Infrastructure/AircraftRepository.cs +++ b/Back/skydiveLogs-api.Infrastructure/AircraftRepository.cs @@ -1,4 +1,4 @@ -using LiteDB; +using LiteDB; using skydiveLogs_api.Domain; using skydiveLogs_api.DomainService.Repositories; using skydiveLogs_api.Infrastructure.Interfaces; @@ -11,6 +11,10 @@ namespace skydiveLogs_api.Infrastructure { #region Public Constructors + /// + /// Initializes a new instance of the class + /// + /// The data provider to use for data access public AircraftRepository(IDataProvider dataProvider) { _dataProvider = dataProvider; @@ -21,6 +25,11 @@ namespace skydiveLogs_api.Infrastructure #region Public Methods + /// + /// Adds a new aircraft to the database + /// + /// The aircraft instance to add + /// The number of rows affected (0 if insert failed) public int Add(Aircraft newAircraft) { int result; @@ -38,21 +47,39 @@ namespace skydiveLogs_api.Infrastructure return result; } + /// + /// Retrieves all aircraft from the database + /// + /// A collection of all aircraft instances public IEnumerable GetAll() { return _col.FindAll().ToList(); } + /// + /// Retrieves an aircraft by its unique identifier + /// + /// The unique identifier of the aircraft + /// The aircraft instance or null if not found public Aircraft GetById(int id) { return _col.FindById(new BsonValue(id)); } + /// + /// Gets the total count of aircraft in the database + /// + /// The total number of aircraft public int GetCount() { throw new System.NotImplementedException(); } + /// + /// Updates an existing aircraft in the database + /// + /// The aircraft instance to update + /// True if the update was successful, false otherwise public bool Update(Aircraft aircraft) { return _col.Update(aircraft); @@ -67,4 +94,4 @@ namespace skydiveLogs_api.Infrastructure #endregion Private Fields } -} \ No newline at end of file +} diff --git a/Back/skydiveLogs-api.Infrastructure/DropZoneRepository.cs b/Back/skydiveLogs-api.Infrastructure/DropZoneRepository.cs index bb38394..9e5919a 100644 --- a/Back/skydiveLogs-api.Infrastructure/DropZoneRepository.cs +++ b/Back/skydiveLogs-api.Infrastructure/DropZoneRepository.cs @@ -1,4 +1,4 @@ -using LiteDB; +using LiteDB; using skydiveLogs_api.Domain; using skydiveLogs_api.DomainService.Repositories; using skydiveLogs_api.Infrastructure.Interfaces; @@ -11,6 +11,10 @@ namespace skydiveLogs_api.Infrastructure { #region Public Constructors + /// + /// Initializes a new instance of the class + /// + /// The data provider to use for data access public DropZoneRepository(IDataProvider dataProvider) { _dataProvider = dataProvider; @@ -21,13 +25,18 @@ namespace skydiveLogs_api.Infrastructure #region Public Methods - public int Add(DropZone newDz) + /// + /// Adds a new drop zone to the database + /// + /// The drop zone instance to add + /// The number of rows affected (0 if insert failed) + public int Add(DropZone newDropZone) { int result; try { - var tmp = _col.Insert(newDz); + var tmp = _col.Insert(newDropZone); result = tmp.AsInt32; } catch @@ -38,24 +47,42 @@ namespace skydiveLogs_api.Infrastructure return result; } + /// + /// Retrieves all drop zones from the database + /// + /// A collection of all drop zone instances public IEnumerable GetAll() { return _col.FindAll().ToList(); } + /// + /// Retrieves a drop zone by its unique identifier + /// + /// The unique identifier of the drop zone + /// The drop zone instance or null if not found public DropZone GetById(int id) { return _col.FindById(new BsonValue(id)); } + /// + /// Gets the total count of drop zones in the database + /// + /// The total number of drop zones public int GetCount() { throw new System.NotImplementedException(); } - public bool Update(DropZone updatedDz) + /// + /// Updates an existing drop zone in the database + /// + /// The drop zone instance to update + /// True if the update was successful, false otherwise + public bool Update(DropZone dropZone) { - return _col.Update(updatedDz); + return _col.Update(dropZone); } #endregion Public Methods @@ -67,4 +94,4 @@ namespace skydiveLogs_api.Infrastructure #endregion Private Fields } -} \ No newline at end of file +} diff --git a/Back/skydiveLogs-api.Infrastructure/FavoriteDropZoneRepository.cs b/Back/skydiveLogs-api.Infrastructure/FavoriteDropZoneRepository.cs index 12d1d13..41c49d1 100644 --- a/Back/skydiveLogs-api.Infrastructure/FavoriteDropZoneRepository.cs +++ b/Back/skydiveLogs-api.Infrastructure/FavoriteDropZoneRepository.cs @@ -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 + /// + /// Initializes a new instance of the class + /// + /// The data provider to use for data access public FavoriteDropZoneRepository(IDataProvider dataProvider) { _dataProvider = dataProvider; @@ -20,6 +24,11 @@ namespace skydiveLogs_api.Infrastructure #region Public Methods + /// + /// 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) public int Add(FavoriteDropZone favoriteToAdd) { int result; @@ -37,11 +46,22 @@ namespace skydiveLogs_api.Infrastructure return result; } + /// + /// Deletes a favorite drop zone 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) 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 + /// + /// The user whose favorite drop zones to retrieve + /// A collection of favorite drop zone instances belonging to the user public IEnumerable GetAll(User user) { return _col.Query() @@ -49,21 +69,39 @@ namespace skydiveLogs_api.Infrastructure .ToList(); } + /// + /// Retrieves all favorite drop zones from the database + /// + /// A collection of all favorite drop zone instances public IEnumerable GetAll() { throw new System.NotImplementedException(); } + /// + /// 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 public FavoriteDropZone GetById(int id) { throw new System.NotImplementedException(); } + /// + /// Gets the total count of favorite drop zones in the database + /// + /// The total number of favorite drop zones public int GetCount() { throw new System.NotImplementedException(); } + /// + /// Updates an existing favorite drop zone in the database + /// + /// The favorite drop zone instance to update + /// True if the update was successful, false otherwise public bool Update(FavoriteDropZone updated) { throw new System.NotImplementedException(); @@ -78,4 +116,4 @@ namespace skydiveLogs_api.Infrastructure #endregion Private Fields } -} \ No newline at end of file +} diff --git a/Back/skydiveLogs-api.Infrastructure/GearRepository.cs b/Back/skydiveLogs-api.Infrastructure/GearRepository.cs index 9ede950..b8beda0 100644 --- a/Back/skydiveLogs-api.Infrastructure/GearRepository.cs +++ b/Back/skydiveLogs-api.Infrastructure/GearRepository.cs @@ -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 + /// + /// Initializes a new instance of the class + /// + /// The data provider to use for data access public GearRepository(IDataProvider dataProvider) { _dataProvider = dataProvider; @@ -20,6 +24,11 @@ namespace skydiveLogs_api.Infrastructure #region Public Methods + /// + /// Adds a new gear item to the database + /// + /// The gear instance to add + /// The number of rows affected (0 if insert failed) public int Add(Gear newGear) { int result; @@ -37,11 +46,20 @@ namespace skydiveLogs_api.Infrastructure return result; } + /// + /// Retrieves all gear items from the database + /// + /// A collection of all gear instances public IEnumerable GetAll() { throw new System.NotImplementedException(); } + /// + /// Retrieves all gear items for a specific user + /// + /// The user whose gear items to retrieve + /// A collection of gear instances belonging to the user public IEnumerable GetAll(User user) { return _col.Include(x => x.User) @@ -50,16 +68,30 @@ namespace skydiveLogs_api.Infrastructure .ToList(); } + /// + /// Retrieves a gear item by its unique identifier + /// + /// The unique identifier of the gear + /// The gear instance or null if not found public Gear GetById(int id) { return _col.FindById(new BsonValue(id)); } + /// + /// Gets the total count of gear items in the database + /// + /// The total number of gear items public int GetCount() { throw new System.NotImplementedException(); } + /// + /// Updates an existing gear item in the database + /// + /// The gear instance to update + /// True if the update was successful, false otherwise public bool Update(Gear updatedGear) { return _col.Update(updatedGear); @@ -74,4 +106,4 @@ namespace skydiveLogs_api.Infrastructure #endregion Private Fields } -} \ No newline at end of file +} diff --git a/Back/skydiveLogs-api.Infrastructure/JumpRepository.cs b/Back/skydiveLogs-api.Infrastructure/JumpRepository.cs index acdc3f9..177c928 100644 --- a/Back/skydiveLogs-api.Infrastructure/JumpRepository.cs +++ b/Back/skydiveLogs-api.Infrastructure/JumpRepository.cs @@ -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 + /// + /// Initializes a new instance of the class + /// + /// The data provider to use for data access public JumpRepository(IDataProvider dataProvider) { _dataProvider = dataProvider; @@ -20,6 +24,11 @@ namespace skydiveLogs_api.Infrastructure #region Public Methods + /// + /// Adds a new jump to the database + /// + /// The jump instance to add + /// The number of rows affected (0 if insert failed) public int Add(Jump newJump) { int result; @@ -37,11 +46,21 @@ namespace skydiveLogs_api.Infrastructure return result; } + /// + /// Deletes a jump by its unique identifier + /// + /// The unique identifier of the jump to delete + /// True if the deletion was successful, false otherwise public bool DeleteById(int id) { return _col.Delete(new BsonValue(id)); } + /// + /// Retrieves all jumps for a specific user + /// + /// The user whose jumps to retrieve + /// A collection of jump instances belonging to the user public IEnumerable GetAll(User user) { return _col.Include(x => x.Aircraft) @@ -51,11 +70,22 @@ namespace skydiveLogs_api.Infrastructure .Find(j => j.User.Id == user.Id); } + /// + /// Retrieves all jumps from the database + /// + /// A collection of all jump instances public IEnumerable GetAll() { throw new System.NotImplementedException(); } + /// + /// Retrieves a range of jumps for a specific user + /// + /// The user whose jumps to retrieve + /// The starting index + /// The ending index + /// A collection of jump instances public IEnumerable GetBetweenIndex(User user, int beginIndex, int endIndex) { return _col.Include(x => x.Aircraft) @@ -70,21 +100,40 @@ namespace skydiveLogs_api.Infrastructure .ToList(); } + /// + /// Retrieves a jump by its unique identifier + /// + /// The unique identifier of the jump + /// The jump instance or null if not found public Jump GetById(int id) { return _col.FindById(new BsonValue(id)); } + /// + /// Gets the total count of jumps for a specific user + /// + /// The user whose jumps to count + /// The total number of jumps public int GetCount(User user) { return _col.Count(j => j.User.Id == user.Id); } + /// + /// Gets the total count of jumps in the database + /// + /// The total number of jumps public int GetCount() { throw new System.NotImplementedException(); } + /// + /// Updates an existing jump in the database + /// + /// The jump instance to update + /// True if the update was successful, false otherwise public bool Update(Jump updatedJump) { return _col.Update(updatedJump); @@ -99,4 +148,4 @@ namespace skydiveLogs_api.Infrastructure #endregion Private Fields } -} \ No newline at end of file +} diff --git a/Back/skydiveLogs-api.Infrastructure/JumpTypeRepository.cs b/Back/skydiveLogs-api.Infrastructure/JumpTypeRepository.cs index c113fb9..29690c3 100644 --- a/Back/skydiveLogs-api.Infrastructure/JumpTypeRepository.cs +++ b/Back/skydiveLogs-api.Infrastructure/JumpTypeRepository.cs @@ -1,4 +1,4 @@ -using LiteDB; +using LiteDB; using skydiveLogs_api.Domain; using skydiveLogs_api.DomainService.Repositories; using skydiveLogs_api.Infrastructure.Interfaces; @@ -11,6 +11,10 @@ namespace skydiveLogs_api.Infrastructure { #region Public Constructors + /// + /// Initializes a new instance of the class + /// + /// The data provider to use for data access public JumpTypeRepository(IDataProvider dataProvider) { _dataProvider = dataProvider; @@ -21,6 +25,11 @@ namespace skydiveLogs_api.Infrastructure #region Public Methods + /// + /// Adds a new jump type to the database + /// + /// The jump type instance to add + /// The number of rows affected (0 if insert failed) public int Add(JumpType newJumpType) { int result; @@ -38,21 +47,39 @@ namespace skydiveLogs_api.Infrastructure return result; } + /// + /// Retrieves all jump types from the database + /// + /// A collection of all jump type instances public IEnumerable GetAll() { return _col.FindAll().ToList(); } + /// + /// Retrieves a jump type by its unique identifier + /// + /// The unique identifier of the jump type + /// The jump type instance or null if not found public JumpType GetById(int id) { return _col.FindById(new BsonValue(id)); } + /// + /// Gets the total count of jump types in the database + /// + /// The total number of jump types public int GetCount() { throw new System.NotImplementedException(); } + /// + /// Updates an existing jump type in the database + /// + /// The jump type instance to update + /// True if the update was successful, false otherwise public bool Update(JumpType updatedJumpType) { return _col.Update(updatedJumpType); @@ -67,4 +94,4 @@ namespace skydiveLogs_api.Infrastructure #endregion Private Fields } -} \ No newline at end of file +} diff --git a/Back/skydiveLogs-api.Infrastructure/UserRepository.cs b/Back/skydiveLogs-api.Infrastructure/UserRepository.cs index e1a4e7f..99ce326 100644 --- a/Back/skydiveLogs-api.Infrastructure/UserRepository.cs +++ b/Back/skydiveLogs-api.Infrastructure/UserRepository.cs @@ -1,4 +1,4 @@ -using LiteDB; +using LiteDB; using skydiveLogs_api.Domain; using skydiveLogs_api.DomainService.Repositories; using skydiveLogs_api.Infrastructure.Interfaces; @@ -11,6 +11,10 @@ namespace skydiveLogs_api.Infrastructure { #region Public Constructors + /// + /// Initializes a new instance of the class + /// + /// The data provider to use for data access public UserRepository(IDataProvider dataProvider) { _dataProvider = dataProvider; @@ -21,6 +25,11 @@ namespace skydiveLogs_api.Infrastructure #region Public Methods + /// + /// Adds a new user to the database + /// + /// The user instance to add + /// The number of rows affected (0 if insert failed) public int Add(User newUser) { int result; @@ -38,26 +47,50 @@ namespace skydiveLogs_api.Infrastructure return result; } + /// + /// Retrieves all users from the database + /// + /// A collection of all user instances public IEnumerable GetAll() { throw new NotImplementedException(); } + /// + /// Retrieves a user by its unique identifier + /// + /// The unique identifier of the user + /// The user instance or null if not found public User GetById(int id) { return _col.FindById(new BsonValue(id)); } + /// + /// Retrieves a user by their login credentials + /// + /// The user's login + /// The user's password + /// The user instance or null if not found public User GetByLogin(string login, string password) { return _col.FindOne(u => u.Login == login && u.Password == password); } + /// + /// Gets the total count of users in the database + /// + /// The total number of users public int GetCount() { throw new System.NotImplementedException(); } + /// + /// Updates an existing user in the database + /// + /// The user instance to update + /// True if the update was successful, false otherwise public bool Update(User updated) { throw new NotImplementedException(); @@ -72,4 +105,4 @@ namespace skydiveLogs_api.Infrastructure #endregion Private Fields } -} \ No newline at end of file +}