Little test with AI + Add the equipment #8
@@ -4,14 +4,20 @@
|
|||||||
{
|
{
|
||||||
#region Public Properties
|
#region Public Properties
|
||||||
|
|
||||||
public string Aad { get; set; }
|
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public string Aad { get; set; }
|
||||||
|
|
||||||
public string MainCanopy { get; set; }
|
public string MainCanopy { get; set; }
|
||||||
|
|
||||||
public string Manufacturer { get; set; }
|
public string Manufacturer { get; set; }
|
||||||
|
|
||||||
public int MaxSize { get; set; }
|
public int MaxSize { get; set; }
|
||||||
|
|
||||||
public int MinSize { get; set; }
|
public int MinSize { get; set; }
|
||||||
|
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
public string ReserveCanopy { get; set; }
|
public string ReserveCanopy { get; set; }
|
||||||
|
|
||||||
public User User { get; set; }
|
public User User { get; set; }
|
||||||
|
|||||||
@@ -6,20 +6,32 @@ namespace skydiveLogs_api.Domain
|
|||||||
{
|
{
|
||||||
#region Public Properties
|
#region Public Properties
|
||||||
|
|
||||||
public Aircraft Aircraft { get; set; }
|
|
||||||
public int DeployAltitude { get; set; }
|
|
||||||
public DropZone DropZone { get; set; }
|
|
||||||
public int ExitAltitude { get; set; }
|
|
||||||
public Gear Gear { get; set; }
|
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public Aircraft Aircraft { get; set; }
|
||||||
|
|
||||||
|
public int DeployAltitude { get; set; }
|
||||||
|
|
||||||
|
public DropZone DropZone { get; set; }
|
||||||
|
|
||||||
|
public int ExitAltitude { get; set; }
|
||||||
|
|
||||||
|
public Gear Gear { get; set; }
|
||||||
|
|
||||||
public bool IsSpecial { get; set; }
|
public bool IsSpecial { get; set; }
|
||||||
|
|
||||||
public DateTime JumpDate { get; set; }
|
public DateTime JumpDate { get; set; }
|
||||||
|
|
||||||
public JumpType JumpType { get; set; }
|
public JumpType JumpType { get; set; }
|
||||||
|
|
||||||
public string Notes { get; set; }
|
public string Notes { get; set; }
|
||||||
|
|
||||||
public User User { get; set; }
|
public User User { get; set; }
|
||||||
|
|
||||||
public bool WithCutaway { get; set; }
|
public bool WithCutaway { get; set; }
|
||||||
|
|
||||||
|
public string Equipment { get; set; }
|
||||||
|
|
||||||
#endregion Public Properties
|
#endregion Public Properties
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -11,6 +11,11 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
{
|
{
|
||||||
#region Public Constructors
|
#region Public Constructors
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="AircraftService"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="aircraftRepository">The aircraft repository for data access.</param>
|
||||||
|
/// <param name="cacheService">The cache service for caching operations.</param>
|
||||||
public AircraftService(IAircraftRepository aircraftRepository,
|
public AircraftService(IAircraftRepository aircraftRepository,
|
||||||
ICacheService cacheService)
|
ICacheService cacheService)
|
||||||
{
|
{
|
||||||
@@ -22,23 +27,40 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a new aircraft to the system.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="newAircraft">The Aircraft entity containing the data for the new aircraft.</param>
|
||||||
public void AddNewAircraft(Aircraft newAircraft)
|
public void AddNewAircraft(Aircraft newAircraft)
|
||||||
{
|
{
|
||||||
_aircraftRepository.Add(newAircraft);
|
_aircraftRepository.Add(newAircraft);
|
||||||
_cacheService.Delete(CacheType.Aircraft);
|
_cacheService.Delete(CacheType.Aircraft);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deletes an aircraft by its ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The aircraft ID to delete.</param>
|
||||||
public void DeleteAircraftById(int id)
|
public void DeleteAircraftById(int id)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves an aircraft by its ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The aircraft ID to retrieve.</param>
|
||||||
|
/// <returns>An Aircraft entity containing the aircraft details.</returns>
|
||||||
public Aircraft GetAircraftById(int id)
|
public Aircraft GetAircraftById(int id)
|
||||||
{
|
{
|
||||||
var allAircrafts = GetAllAircrafts();
|
var allAircrafts = GetAllAircrafts();
|
||||||
return allAircrafts.Single(g => g.Id == id);
|
return allAircrafts.Single(g => g.Id == id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves all aircrafts.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of Aircraft entities containing all aircraft data.</returns>
|
||||||
public IEnumerable<Aircraft> GetAllAircrafts()
|
public IEnumerable<Aircraft> GetAllAircrafts()
|
||||||
{
|
{
|
||||||
if (!_cacheService.Contains(CacheType.Aircraft))
|
if (!_cacheService.Contains(CacheType.Aircraft))
|
||||||
@@ -49,6 +71,13 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
return _cacheService.Get<IEnumerable<Aircraft>>(CacheType.Aircraft);
|
return _cacheService.Get<IEnumerable<Aircraft>>(CacheType.Aircraft);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates an existing aircraft.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The aircraft ID to update.</param>
|
||||||
|
/// <param name="aircraft">Aircraft entity containing the updated aircraft data.</param>
|
||||||
|
/// <param name="resetCache">Whether to reset the cache after update.</param>
|
||||||
|
/// <returns>True if the update was successful, false otherwise.</returns>
|
||||||
public bool UpdateAircraft(int id, Aircraft aircraft, bool resetCache = true)
|
public bool UpdateAircraft(int id, Aircraft aircraft, bool resetCache = true)
|
||||||
{
|
{
|
||||||
aircraft.Id = id;
|
aircraft.Id = id;
|
||||||
@@ -69,4 +98,4 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,24 +24,50 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Checks if a specific cache entry exists for a given type and user ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type">The type of data to check for in the cache.</param>
|
||||||
|
/// <param name="userId">Optional user ID to distinguish cache entries. Default is 0.</param>
|
||||||
|
/// <returns>True if the cache entry exists and is valid, otherwise false.</returns>
|
||||||
public bool Contains(CacheType type, int userId = 0)
|
public bool Contains(CacheType type, int userId = 0)
|
||||||
{
|
{
|
||||||
var key = GetKey(userId, type);
|
var key = GetKey(userId, type);
|
||||||
return _memoryCache.Contains(key.ToString());
|
return _memoryCache.Contains(key.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes a cache entry from the store.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type">The type of data to remove from the cache.</param>
|
||||||
|
/// <param name="userId">Optional user ID to identify the cache entry. Default is 0.</param>
|
||||||
public void Delete(CacheType type, int userId = 0)
|
public void Delete(CacheType type, int userId = 0)
|
||||||
{
|
{
|
||||||
var key = GetKey(userId, type);
|
var key = GetKey(userId, type);
|
||||||
_memoryCache.Remove(key.ToString());
|
_memoryCache.Remove(key.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves data from the cache for a specified type and user ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">The expected type of the cached data.</typeparam>
|
||||||
|
/// <param name="type">The type of data to retrieve from the cache.</param>
|
||||||
|
/// <param name="userId">Optional user ID to identify the cache entry. Default is 0.</param>
|
||||||
|
/// <returns>The cached data cast to type T, or default(T) if not found or expired.</returns>
|
||||||
public T Get<T>(CacheType type, int userId = 0)
|
public T Get<T>(CacheType type, int userId = 0)
|
||||||
{
|
{
|
||||||
var key = GetKey(userId, type);
|
var key = GetKey(userId, type);
|
||||||
return (T)_memoryCache.Get(key.ToString());
|
return (T)_memoryCache.Get(key.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Stores data in the cache with a specified expiry time.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type">The unique identifier for the cache key.</param>
|
||||||
|
/// <param name="value">The object data to be cached.</param>
|
||||||
|
/// <param name="duration">The duration in milliseconds before the cache entry expires.</param>
|
||||||
|
/// <param name="userId">Optional user ID to distinguish cache entries. Default is 0.</param>
|
||||||
|
/// <exception cref="ArgumentException">Thrown when duration is less than or equal to zero.</exception>
|
||||||
public void Put(CacheType type, object value, int duration, int userId = 0)
|
public void Put(CacheType type, object value, int duration, int userId = 0)
|
||||||
{
|
{
|
||||||
var key = GetKey(userId, type);
|
var key = GetKey(userId, type);
|
||||||
@@ -56,6 +82,12 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
_memoryCache.Set(key.ToString(), value, policy);
|
_memoryCache.Set(key.ToString(), value, policy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Generates a cache key by combining the user ID and cache type.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userId">The user ID to include in the key.</param>
|
||||||
|
/// <param name="type">The cache type to include in the key.</param>
|
||||||
|
/// <returns>A concatenated string key combining userId and type.</returns>
|
||||||
private string GetKey(int userId, CacheType type)
|
private string GetKey(int userId, CacheType type)
|
||||||
{
|
{
|
||||||
return $"{userId}-{type}";
|
return $"{userId}-{type}";
|
||||||
@@ -63,4 +95,4 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#endregion Public Methods
|
#endregion Public Methods
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,12 +26,21 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a new drop zone to the system.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="newdropZone">The DropZone entity containing the new drop zone data.</param>
|
||||||
public void AddNewDz(DropZone newdropZone)
|
public void AddNewDz(DropZone newdropZone)
|
||||||
{
|
{
|
||||||
_dropZoneRepository.Add(newdropZone);
|
_dropZoneRepository.Add(newdropZone);
|
||||||
_cacheService.Delete(CacheType.DropZone);
|
_cacheService.Delete(CacheType.DropZone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a drop zone to the user's favorites.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dzId">The drop zone ID to add to favorites.</param>
|
||||||
|
/// <returns>True if the drop zone was added to favorites, false otherwise.</returns>
|
||||||
public bool AddToFavorite(int dzId)
|
public bool AddToFavorite(int dzId)
|
||||||
{
|
{
|
||||||
var dzToAddToFavorite = GetDzById(dzId);
|
var dzToAddToFavorite = GetDzById(dzId);
|
||||||
@@ -47,11 +56,19 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
return result > 0;
|
return result > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deletes a drop zone by its ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The drop zone ID to delete.</param>
|
||||||
public void DeleteDzById(int id)
|
public void DeleteDzById(int id)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves a list of all drop zones with favorites status.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of DropZone entities containing all drop zones with their favorite status.</returns>
|
||||||
public IEnumerable<DropZone> GetAllDzs()
|
public IEnumerable<DropZone> GetAllDzs()
|
||||||
{
|
{
|
||||||
var results = Enumerable.Empty<DropZone>();
|
var results = Enumerable.Empty<DropZone>();
|
||||||
@@ -78,12 +95,22 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
return results.ToList();
|
return results.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves a drop zone by its ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The drop zone ID to retrieve.</param>
|
||||||
|
/// <returns>A DropZone entity containing the drop zone details.</returns>
|
||||||
public DropZone GetDzById(int id)
|
public DropZone GetDzById(int id)
|
||||||
{
|
{
|
||||||
var allDzs = GetAllRefDzs();
|
var allDzs = GetAllRefDzs();
|
||||||
return allDzs.Single(g => g.Id == id);
|
return allDzs.Single(g => g.Id == id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes a drop zone from the user's favorites.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dzId">The drop zone ID to remove from favorites.</param>
|
||||||
|
/// <returns>True if the drop zone was removed from favorites, false otherwise.</returns>
|
||||||
public bool RemoveToFavorite(int dzId)
|
public bool RemoveToFavorite(int dzId)
|
||||||
{
|
{
|
||||||
var result = _favoriteDropZoneRepository.Delete(dzId, _identityService.ConnectedUser.Id);
|
var result = _favoriteDropZoneRepository.Delete(dzId, _identityService.ConnectedUser.Id);
|
||||||
@@ -92,6 +119,13 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
return result > 0;
|
return result > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates an existing drop zone.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The drop zone ID to update.</param>
|
||||||
|
/// <param name="dropZone">DropZone entity containing the updated drop zone data.</param>
|
||||||
|
/// <param name="resetCache">Whether to reset the cache after update.</param>
|
||||||
|
/// <returns>True if the update was successful, false otherwise.</returns>
|
||||||
public bool UpdateDz(int id, DropZone dropZone, bool resetCache = true)
|
public bool UpdateDz(int id, DropZone dropZone, bool resetCache = true)
|
||||||
{
|
{
|
||||||
dropZone.Id = id;
|
dropZone.Id = id;
|
||||||
@@ -124,4 +158,4 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,10 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a new gear item to the system.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="newGear">The Gear entity containing the new gear data.</param>
|
||||||
public void AddNewGear(Gear newGear)
|
public void AddNewGear(Gear newGear)
|
||||||
{
|
{
|
||||||
newGear.User = _identityService.ConnectedUser;
|
newGear.User = _identityService.ConnectedUser;
|
||||||
@@ -33,6 +37,10 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
_cacheService.Delete(CacheType.Gear, userId: userId);
|
_cacheService.Delete(CacheType.Gear, userId: userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds rental gear to the system for a new user.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="newUser">The new user for whom rental gear should be added.</param>
|
||||||
public void AddRentalGear(User newUser)
|
public void AddRentalGear(User newUser)
|
||||||
{
|
{
|
||||||
var rentalGear = new Gear
|
var rentalGear = new Gear
|
||||||
@@ -50,11 +58,19 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
_gearRepository.Add(rentalGear);
|
_gearRepository.Add(rentalGear);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deletes a gear item by its ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The gear ID to delete.</param>
|
||||||
public void DeleteGearById(int id)
|
public void DeleteGearById(int id)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves all gear items.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of Gear entities containing all gear data.</returns>
|
||||||
public IEnumerable<Gear> GetAllGears()
|
public IEnumerable<Gear> GetAllGears()
|
||||||
{
|
{
|
||||||
var userId = _identityService.ConnectedUser.Id;
|
var userId = _identityService.ConnectedUser.Id;
|
||||||
@@ -67,17 +83,33 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
return _cacheService.Get<IEnumerable<Gear>>(CacheType.Gear, userId: userId);
|
return _cacheService.Get<IEnumerable<Gear>>(CacheType.Gear, userId: userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves a gear item by its ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The gear ID to retrieve.</param>
|
||||||
|
/// <returns>A Gear entity containing the gear details.</returns>
|
||||||
public Gear GetGearById(int id)
|
public Gear GetGearById(int id)
|
||||||
{
|
{
|
||||||
var allGears = GetAllGears();
|
var allGears = GetAllGears();
|
||||||
return allGears.Single(g => g.Id == id);
|
return allGears.Single(g => g.Id == id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates an existing gear item.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The gear ID to update.</param>
|
||||||
|
/// <param name="gear">Gear entity containing the updated gear data.</param>
|
||||||
|
/// <returns>True if the update was successful, false otherwise.</returns>
|
||||||
public bool UpdateGear(int id, Gear gear)
|
public bool UpdateGear(int id, Gear gear)
|
||||||
{
|
{
|
||||||
gear.Id = id;
|
gear.Id = id;
|
||||||
|
gear.User = _identityService.ConnectedUser;
|
||||||
|
|
||||||
return _gearRepository.Update(gear);
|
var tmp = _gearRepository.Update(gear);
|
||||||
|
var userId = _identityService.ConnectedUser.Id;
|
||||||
|
_cacheService.Delete(CacheType.Gear, userId: userId);
|
||||||
|
|
||||||
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Public Methods
|
#endregion Public Methods
|
||||||
@@ -90,4 +122,4 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,9 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates the existing data in the database.
|
||||||
|
/// </summary>
|
||||||
public void Update()
|
public void Update()
|
||||||
{
|
{
|
||||||
UpdateAircrafts();
|
UpdateAircrafts();
|
||||||
@@ -38,6 +41,9 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
_cacheService.Delete(CacheType.JumpType);
|
_cacheService.Delete(CacheType.JumpType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Generates the database structure and initial data.
|
||||||
|
/// </summary>
|
||||||
public void GenerateDb()
|
public void GenerateDb()
|
||||||
{
|
{
|
||||||
LoadAircrafts();
|
LoadAircrafts();
|
||||||
@@ -193,4 +199,4 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,14 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a new jump to the system.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="aircraftId">The ID of the aircraft to use for this jump.</param>
|
||||||
|
/// <param name="dzId">The ID of the drop zone for this jump.</param>
|
||||||
|
/// <param name="jumpTypeId">The ID of the jump type for this jump.</param>
|
||||||
|
/// <param name="gearId">The ID of the gear for this jump.</param>
|
||||||
|
/// <param name="jump">Jump entity containing the new jump data.</param>
|
||||||
public void AddNewJump(int aircraftId,
|
public void AddNewJump(int aircraftId,
|
||||||
int dzId,
|
int dzId,
|
||||||
int jumpTypeId,
|
int jumpTypeId,
|
||||||
@@ -48,37 +56,66 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
_jumpRepository.Add(jump);
|
_jumpRepository.Add(jump);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deletes a jump by its ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The jump ID to delete.</param>
|
||||||
public void DeleteJumpById(int id)
|
public void DeleteJumpById(int id)
|
||||||
{
|
{
|
||||||
_jumpRepository.DeleteById(id);
|
_jumpRepository.DeleteById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves all jumps for the current user.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of Jump entities containing all jumps.</returns>
|
||||||
public IEnumerable<Jump> GetAllJumps()
|
public IEnumerable<Jump> GetAllJumps()
|
||||||
{
|
{
|
||||||
return _jumpRepository.GetAll(_identityService.ConnectedUser);
|
return _jumpRepository.GetAll(_identityService.ConnectedUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves a jump by its ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The jump ID to retrieve.</param>
|
||||||
|
/// <returns>A Jump entity containing the jump details.</returns>
|
||||||
public Jump GetJumpById(int id)
|
public Jump GetJumpById(int id)
|
||||||
{
|
{
|
||||||
return _jumpRepository.GetById(id);
|
return _jumpRepository.GetById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the total count of jumps for the current user.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The total number of jumps.</returns>
|
||||||
public int GetJumpCount()
|
public int GetJumpCount()
|
||||||
{
|
{
|
||||||
return _jumpRepository.GetCount(_identityService.ConnectedUser);
|
return _jumpRepository.GetCount(_identityService.ConnectedUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves a range of jumps for the current user with pagination.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="beginIndex">The starting index for pagination.</param>
|
||||||
|
/// <param name="endIndex">The ending index for pagination.</param>
|
||||||
|
/// <returns>A collection of Jump entities containing the requested range.</returns>
|
||||||
public IEnumerable<Jump> GetJumpsByIndexes(int beginIndex, int endIndex)
|
public IEnumerable<Jump> GetJumpsByIndexes(int beginIndex, int endIndex)
|
||||||
{
|
{
|
||||||
return _jumpRepository.GetBetweenIndex(_identityService.ConnectedUser, beginIndex, endIndex);
|
return _jumpRepository.GetBetweenIndex(_identityService.ConnectedUser, beginIndex, endIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates an existing jump.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The jump ID to update.</param>
|
||||||
|
/// <param name="updatedJump">Jump entity containing the updated jump data.</param>
|
||||||
public void UpdateJump(int id, Jump updatedJump)
|
public void UpdateJump(int id, Jump updatedJump)
|
||||||
{
|
{
|
||||||
var myJump = GetJumpById(id);
|
var myJump = GetJumpById(id);
|
||||||
myJump.IsSpecial = updatedJump.IsSpecial;
|
myJump.IsSpecial = updatedJump.IsSpecial;
|
||||||
myJump.WithCutaway = updatedJump.WithCutaway;
|
myJump.WithCutaway = updatedJump.WithCutaway;
|
||||||
myJump.Notes = updatedJump.Notes;
|
myJump.Notes = updatedJump.Notes;
|
||||||
|
myJump.Equipment = updatedJump.Equipment;
|
||||||
|
|
||||||
_jumpRepository.Update(myJump);
|
_jumpRepository.Update(myJump);
|
||||||
}
|
}
|
||||||
@@ -96,4 +133,4 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,17 +22,29 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a new jump type to the system.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="newJumpType">The JumpType entity containing the new jump type data.</param>
|
||||||
public void AddNewJumpType(JumpType newJumpType)
|
public void AddNewJumpType(JumpType newJumpType)
|
||||||
{
|
{
|
||||||
_jumpTypeRepository.Add(newJumpType);
|
_jumpTypeRepository.Add(newJumpType);
|
||||||
_cacheService.Delete(CacheType.JumpType);
|
_cacheService.Delete(CacheType.JumpType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deletes a jump type by its ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The jump type ID to delete.</param>
|
||||||
public void DeleteJumpTypeById(int id)
|
public void DeleteJumpTypeById(int id)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves all jump types.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of JumpType entities containing all jump types.</returns>
|
||||||
public IEnumerable<JumpType> GetAllJumpTypes()
|
public IEnumerable<JumpType> GetAllJumpTypes()
|
||||||
{
|
{
|
||||||
if (!_cacheService.Contains(CacheType.JumpType))
|
if (!_cacheService.Contains(CacheType.JumpType))
|
||||||
@@ -43,17 +55,33 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
return _cacheService.Get<IEnumerable<JumpType>>(CacheType.JumpType);
|
return _cacheService.Get<IEnumerable<JumpType>>(CacheType.JumpType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves jump types specifically used for tunnel operations.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of JumpType entities containing tunnel jump types.</returns>
|
||||||
public IEnumerable<JumpType> GetJumpTypesForTunnel()
|
public IEnumerable<JumpType> GetJumpTypesForTunnel()
|
||||||
{
|
{
|
||||||
return GetAllJumpTypes().Where(t => t.InTunnel);
|
return GetAllJumpTypes().Where(t => t.InTunnel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves a jump type by its ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The jump type ID to retrieve.</param>
|
||||||
|
/// <returns>A JumpType entity containing the jump type details.</returns>
|
||||||
public JumpType GetJumpTypeById(int id)
|
public JumpType GetJumpTypeById(int id)
|
||||||
{
|
{
|
||||||
var allJumpTypes = GetAllJumpTypes();
|
var allJumpTypes = GetAllJumpTypes();
|
||||||
return allJumpTypes.Single(g => g.Id == id);
|
return allJumpTypes.Single(g => g.Id == id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates an existing jump type.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The jump type ID to update.</param>
|
||||||
|
/// <param name="jumpType">JumpType entity containing the updated jump type data.</param>
|
||||||
|
/// <param name="resetCache">Whether to reset the cache after update.</param>
|
||||||
|
/// <returns>True if the update was successful, false otherwise.</returns>
|
||||||
public bool UpdateJumpType(int id, JumpType jumpType, bool resetCache = true)
|
public bool UpdateJumpType(int id, JumpType jumpType, bool resetCache = true)
|
||||||
{
|
{
|
||||||
jumpType.Id = id;
|
jumpType.Id = id;
|
||||||
@@ -74,4 +102,4 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using skydiveLogs_api.Domain;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using skydiveLogs_api.Domain;
|
||||||
using skydiveLogs_api.DomainBusiness.Interfaces;
|
using skydiveLogs_api.DomainBusiness.Interfaces;
|
||||||
using skydiveLogs_api.DomainService.Repositories;
|
using skydiveLogs_api.DomainService.Repositories;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace skydiveLogs_api.DomainBusiness
|
namespace skydiveLogs_api.DomainBusiness
|
||||||
{
|
{
|
||||||
@@ -23,6 +23,10 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves statistics grouped by aircraft.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of StatsByAircraft entities containing the statistics.</returns>
|
||||||
public IEnumerable<StatsByAircraft> GetStats()
|
public IEnumerable<StatsByAircraft> GetStats()
|
||||||
{
|
{
|
||||||
var allStats = _statsByAircraftRepository.GetAll(_identityService.ConnectedUser);
|
var allStats = _statsByAircraftRepository.GetAll(_identityService.ConnectedUser);
|
||||||
@@ -50,6 +54,9 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
return allStats;
|
return allStats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resets the aircraft statistics.
|
||||||
|
/// </summary>
|
||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
_statsByAircraftRepository.Delete(_identityService.ConnectedUser);
|
_statsByAircraftRepository.Delete(_identityService.ConnectedUser);
|
||||||
@@ -65,4 +72,4 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using skydiveLogs_api.Domain;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using skydiveLogs_api.Domain;
|
||||||
using skydiveLogs_api.DomainBusiness.Interfaces;
|
using skydiveLogs_api.DomainBusiness.Interfaces;
|
||||||
using skydiveLogs_api.DomainService.Repositories;
|
using skydiveLogs_api.DomainService.Repositories;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace skydiveLogs_api.DomainBusiness
|
namespace skydiveLogs_api.DomainBusiness
|
||||||
{
|
{
|
||||||
@@ -23,6 +23,10 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves statistics grouped by drop zone.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of StatsByDz entities containing the statistics.</returns>
|
||||||
public IEnumerable<StatsByDz> GetStats()
|
public IEnumerable<StatsByDz> GetStats()
|
||||||
{
|
{
|
||||||
var allStats = _statsByDzRepository.GetAll(_identityService.ConnectedUser);
|
var allStats = _statsByDzRepository.GetAll(_identityService.ConnectedUser);
|
||||||
@@ -50,6 +54,9 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
return allStats;
|
return allStats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resets the drop zone statistics.
|
||||||
|
/// </summary>
|
||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
_statsByDzRepository.Delete(_identityService.ConnectedUser);
|
_statsByDzRepository.Delete(_identityService.ConnectedUser);
|
||||||
@@ -65,4 +72,4 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using skydiveLogs_api.Domain;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using skydiveLogs_api.Domain;
|
||||||
using skydiveLogs_api.DomainBusiness.Interfaces;
|
using skydiveLogs_api.DomainBusiness.Interfaces;
|
||||||
using skydiveLogs_api.DomainService.Repositories;
|
using skydiveLogs_api.DomainService.Repositories;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace skydiveLogs_api.DomainBusiness
|
namespace skydiveLogs_api.DomainBusiness
|
||||||
{
|
{
|
||||||
@@ -23,6 +23,10 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves statistics grouped by gear.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of StatsByGear entities containing the statistics.</returns>
|
||||||
public IEnumerable<StatsByGear> GetStats()
|
public IEnumerable<StatsByGear> GetStats()
|
||||||
{
|
{
|
||||||
var allStats = _statsByGearRepository.GetAll(_identityService.ConnectedUser);
|
var allStats = _statsByGearRepository.GetAll(_identityService.ConnectedUser);
|
||||||
@@ -50,6 +54,9 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
return allStats;
|
return allStats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resets the gear statistics.
|
||||||
|
/// </summary>
|
||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
_statsByGearRepository.Delete(_identityService.ConnectedUser);
|
_statsByGearRepository.Delete(_identityService.ConnectedUser);
|
||||||
@@ -65,4 +72,4 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,10 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves statistics grouped by jump type.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of StatsByJumpType entities containing the statistics.</returns>
|
||||||
public IEnumerable<StatsByJumpType> GetStats()
|
public IEnumerable<StatsByJumpType> GetStats()
|
||||||
{
|
{
|
||||||
var allStats = _statsByJumpTypeRepository.GetAll(_identityService.ConnectedUser);
|
var allStats = _statsByJumpTypeRepository.GetAll(_identityService.ConnectedUser);
|
||||||
@@ -50,6 +54,9 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
return allStats;
|
return allStats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resets the year and jump type statistics.
|
||||||
|
/// </summary>
|
||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
_statsByJumpTypeRepository.Delete(_identityService.ConnectedUser);
|
_statsByJumpTypeRepository.Delete(_identityService.ConnectedUser);
|
||||||
@@ -65,4 +72,4 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,10 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves statistics grouped by year and jump type.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of StatsByYearByJumpType entities containing the statistics.</returns>
|
||||||
public IEnumerable<StatsByYearByJumpType> GetStats()
|
public IEnumerable<StatsByYearByJumpType> GetStats()
|
||||||
{
|
{
|
||||||
var allStats = _statsByYearByJumpTypeRepository.GetAll(_identityService.ConnectedUser);
|
var allStats = _statsByYearByJumpTypeRepository.GetAll(_identityService.ConnectedUser);
|
||||||
@@ -51,6 +55,9 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
return allStats;
|
return allStats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resets the last year by jump type statistics.
|
||||||
|
/// </summary>
|
||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
_statsByYearByJumpTypeRepository.Delete(_identityService.ConnectedUser);
|
_statsByYearByJumpTypeRepository.Delete(_identityService.ConnectedUser);
|
||||||
@@ -66,4 +73,4 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,10 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves statistics grouped by year.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of StatsByYear entities containing the statistics.</returns>
|
||||||
public IEnumerable<StatsByYear> GetStats()
|
public IEnumerable<StatsByYear> GetStats()
|
||||||
{
|
{
|
||||||
var allStats = _statsByYearRepository.GetAll(_identityService.ConnectedUser);
|
var allStats = _statsByYearRepository.GetAll(_identityService.ConnectedUser);
|
||||||
@@ -50,6 +54,9 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
return allStats;
|
return allStats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resets the year statistics.
|
||||||
|
/// </summary>
|
||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
_statsByYearRepository.Delete(_identityService.ConnectedUser);
|
_statsByYearRepository.Delete(_identityService.ConnectedUser);
|
||||||
@@ -65,4 +72,4 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,10 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves statistics for the last month grouped by drop zone.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of StatsForLastMonthByDz entities containing the statistics.</returns>
|
||||||
public IEnumerable<StatsForLastMonthByDz> GetStats()
|
public IEnumerable<StatsForLastMonthByDz> GetStats()
|
||||||
{
|
{
|
||||||
var allStats = _statsForLastMonthByDzRepository.GetAll(_identityService.ConnectedUser);
|
var allStats = _statsForLastMonthByDzRepository.GetAll(_identityService.ConnectedUser);
|
||||||
@@ -55,6 +59,9 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
return allStats;
|
return allStats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resets the last month drop zone statistics.
|
||||||
|
/// </summary>
|
||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
_statsForLastMonthByDzRepository.Delete(_identityService.ConnectedUser);
|
_statsForLastMonthByDzRepository.Delete(_identityService.ConnectedUser);
|
||||||
@@ -70,4 +77,4 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,10 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves statistics for the last month grouped by jump type.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of StatsForLastMonthByJumpType entities containing the statistics.</returns>
|
||||||
public IEnumerable<StatsForLastMonthByJumpType> GetStats()
|
public IEnumerable<StatsForLastMonthByJumpType> GetStats()
|
||||||
{
|
{
|
||||||
var allStats = _statsForLastMonthByJumpTypeRepository.GetAll(_identityService.ConnectedUser);
|
var allStats = _statsForLastMonthByJumpTypeRepository.GetAll(_identityService.ConnectedUser);
|
||||||
@@ -55,6 +59,9 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
return allStats;
|
return allStats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resets the last month jump type statistics.
|
||||||
|
/// </summary>
|
||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
_statsForLastMonthByJumpTypeRepository.Delete(_identityService.ConnectedUser);
|
_statsForLastMonthByJumpTypeRepository.Delete(_identityService.ConnectedUser);
|
||||||
@@ -70,4 +77,4 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,10 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves statistics for the last year grouped by drop zone.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of StatsForLastYearByDz entities containing the statistics.</returns>
|
||||||
public IEnumerable<StatsForLastYearByDz> GetStats()
|
public IEnumerable<StatsForLastYearByDz> GetStats()
|
||||||
{
|
{
|
||||||
var allStats = _statsForLastYearByDzRepository.GetAll(_identityService.ConnectedUser);
|
var allStats = _statsForLastYearByDzRepository.GetAll(_identityService.ConnectedUser);
|
||||||
@@ -54,6 +58,9 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
return allStats;
|
return allStats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resets the last year drop zone statistics.
|
||||||
|
/// </summary>
|
||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
_statsForLastYearByDzRepository.Delete(_identityService.ConnectedUser);
|
_statsForLastYearByDzRepository.Delete(_identityService.ConnectedUser);
|
||||||
@@ -69,4 +76,4 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,10 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves statistics for the last year grouped by jump type.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of StatsForLastYearByJumpType entities containing the statistics.</returns>
|
||||||
public IEnumerable<StatsForLastYearByJumpType> GetStats()
|
public IEnumerable<StatsForLastYearByJumpType> GetStats()
|
||||||
{
|
{
|
||||||
var allStats = _statsForLastYearByJumpTypeRepository.GetAll(_identityService.ConnectedUser);
|
var allStats = _statsForLastYearByJumpTypeRepository.GetAll(_identityService.ConnectedUser);
|
||||||
@@ -54,7 +58,9 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
return allStats;
|
return allStats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resets the last year jump type statistics.
|
||||||
|
/// </summary>
|
||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
_statsForLastYearByJumpTypeRepository.Delete(_identityService.ConnectedUser);
|
_statsForLastYearByJumpTypeRepository.Delete(_identityService.ConnectedUser);
|
||||||
@@ -71,4 +77,4 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,10 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves a simple summary of all statistics.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A SimpleSummary entity containing the simple summary statistics.</returns>
|
||||||
public SimpleSummary GetSimpleSummary()
|
public SimpleSummary GetSimpleSummary()
|
||||||
{
|
{
|
||||||
var allJumps = _jumpService.GetAllJumps();
|
var allJumps = _jumpService.GetAllJumps();
|
||||||
@@ -58,6 +62,9 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resets all statistics.
|
||||||
|
/// </summary>
|
||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
_statsByAircraftService.Reset();
|
_statsByAircraftService.Reset();
|
||||||
@@ -72,6 +79,10 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
_statsForLastYearByJumpTypeService.Reset();
|
_statsForLastYearByJumpTypeService.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves statistics grouped by aircraft.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of Statistic entities containing aircraft statistics.</returns>
|
||||||
public IEnumerable<Statistic> GetStatsByAircraft()
|
public IEnumerable<Statistic> GetStatsByAircraft()
|
||||||
{
|
{
|
||||||
var tmp = _statsByAircraftService.GetStats();
|
var tmp = _statsByAircraftService.GetStats();
|
||||||
@@ -82,6 +93,10 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
})];
|
})];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves statistics grouped by drop zone.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of Statistic entities containing drop zone statistics.</returns>
|
||||||
public IEnumerable<Statistic> GetStatsByDz()
|
public IEnumerable<Statistic> GetStatsByDz()
|
||||||
{
|
{
|
||||||
var tmp = _statsByDzService.GetStats();
|
var tmp = _statsByDzService.GetStats();
|
||||||
@@ -92,6 +107,10 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
})];
|
})];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves statistics grouped by gear.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of Statistic entities containing gear statistics.</returns>
|
||||||
public IEnumerable<Statistic> GetStatsByGear()
|
public IEnumerable<Statistic> GetStatsByGear()
|
||||||
{
|
{
|
||||||
var tmp = _statsByGearService.GetStats();
|
var tmp = _statsByGearService.GetStats();
|
||||||
@@ -102,6 +121,10 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
})];
|
})];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves statistics grouped by jump type.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of Statistic entities containing jump type statistics.</returns>
|
||||||
public IEnumerable<Statistic> GetStatsByJumpType()
|
public IEnumerable<Statistic> GetStatsByJumpType()
|
||||||
{
|
{
|
||||||
var tmp = _statsByJumpTypeService.GetStats();
|
var tmp = _statsByJumpTypeService.GetStats();
|
||||||
@@ -112,6 +135,10 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
})];
|
})];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves statistics grouped by year.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of Statistic entities containing year statistics.</returns>
|
||||||
public IEnumerable<Statistic> GetStatsByYear()
|
public IEnumerable<Statistic> GetStatsByYear()
|
||||||
{
|
{
|
||||||
var tmp = _statsByYearService.GetStats();
|
var tmp = _statsByYearService.GetStats();
|
||||||
@@ -122,6 +149,10 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
})];
|
})];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves statistics for the last month grouped by drop zone.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of Statistic entities containing last month drop zone statistics.</returns>
|
||||||
public IEnumerable<Statistic> GetStatsForLastMonthByDz()
|
public IEnumerable<Statistic> GetStatsForLastMonthByDz()
|
||||||
{
|
{
|
||||||
var tmp = _statsForLastMonthByDzService.GetStats();
|
var tmp = _statsForLastMonthByDzService.GetStats();
|
||||||
@@ -132,6 +163,10 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
})];
|
})];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves statistics for the last month grouped by jump type.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of Statistic entities containing last month jump type statistics.</returns>
|
||||||
public IEnumerable<Statistic> GetStatsForLastMonthByJumpType()
|
public IEnumerable<Statistic> GetStatsForLastMonthByJumpType()
|
||||||
{
|
{
|
||||||
var tmp = _statsForLastMonthByJumpTypeService.GetStats();
|
var tmp = _statsForLastMonthByJumpTypeService.GetStats();
|
||||||
@@ -142,6 +177,10 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
})];
|
})];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves statistics for the last year grouped by drop zone.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of Statistic entities containing last year drop zone statistics.</returns>
|
||||||
public IEnumerable<Statistic> GetStatsForLastYearByDz()
|
public IEnumerable<Statistic> GetStatsForLastYearByDz()
|
||||||
{
|
{
|
||||||
var tmp = _statsForLastYearByDzService.GetStats();
|
var tmp = _statsForLastYearByDzService.GetStats();
|
||||||
@@ -152,6 +191,10 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
})];
|
})];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves statistics for the last year grouped by jump type.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of Statistic entities containing last year jump type statistics.</returns>
|
||||||
public IEnumerable<Statistic> GetStatsForLastYearByJumpType()
|
public IEnumerable<Statistic> GetStatsForLastYearByJumpType()
|
||||||
{
|
{
|
||||||
var tmp = _statsForLastYearByJumpTypeService.GetStats();
|
var tmp = _statsForLastYearByJumpTypeService.GetStats();
|
||||||
@@ -162,6 +205,10 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
})];
|
})];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves statistics by year grouped with jump type.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of Statistic entities containing yearly jump type statistics.</returns>
|
||||||
public IEnumerable<Statistic> GetStatsByYearByJumpType()
|
public IEnumerable<Statistic> GetStatsByYearByJumpType()
|
||||||
{
|
{
|
||||||
var tmp = _statsByYearByJumpTypeService.GetStats();
|
var tmp = _statsByYearByJumpTypeService.GetStats();
|
||||||
@@ -191,4 +238,4 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
{
|
{
|
||||||
#region Public Constructors
|
#region Public Constructors
|
||||||
|
|
||||||
public TunnelFlightService(IJumpTypeService jumpTypeService,
|
public TunnelFlightService(IJumpTypeService jumpTypeService,
|
||||||
ITunnelFlightRepository tunnelFlightRepository,
|
ITunnelFlightRepository tunnelFlightRepository,
|
||||||
IDropZoneService dropZoneService,
|
IDropZoneService dropZoneService,
|
||||||
IIdentityService identityService)
|
IIdentityService identityService)
|
||||||
@@ -26,26 +26,51 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves all tunnel flights.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of TunnelFlight entities containing all tunnel flights.</returns>
|
||||||
public IEnumerable<TunnelFlight> GetAllTunnelFlights()
|
public IEnumerable<TunnelFlight> GetAllTunnelFlights()
|
||||||
{
|
{
|
||||||
return _tunnelFlightRepository.GetAll(_identityService.ConnectedUser);
|
return _tunnelFlightRepository.GetAll(_identityService.ConnectedUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves a tunnel flight by its ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The tunnel flight ID to retrieve.</param>
|
||||||
|
/// <returns>A TunnelFlight entity containing the tunnel flight details.</returns>
|
||||||
public TunnelFlight GetTunnelFlightById(int id)
|
public TunnelFlight GetTunnelFlightById(int id)
|
||||||
{
|
{
|
||||||
return _tunnelFlightRepository.GetById(id);
|
return _tunnelFlightRepository.GetById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the total count of tunnel flights.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The total number of tunnel flights.</returns>
|
||||||
public int GetTunnelFlightCount()
|
public int GetTunnelFlightCount()
|
||||||
{
|
{
|
||||||
return _tunnelFlightRepository.GetCount(_identityService.ConnectedUser);
|
return _tunnelFlightRepository.GetCount(_identityService.ConnectedUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves a range of tunnel flights with pagination.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="beginIndex">The starting index for pagination.</param>
|
||||||
|
/// <param name="endIndex">The ending index for pagination.</param>
|
||||||
|
/// <returns>A collection of TunnelFlight entities containing the requested range.</returns>
|
||||||
public IEnumerable<TunnelFlight> GetTunnelFlightsByIndexes(int beginIndex, int endIndex)
|
public IEnumerable<TunnelFlight> GetTunnelFlightsByIndexes(int beginIndex, int endIndex)
|
||||||
{
|
{
|
||||||
return _tunnelFlightRepository.GetBetweenIndex(_identityService.ConnectedUser, beginIndex, endIndex);
|
return _tunnelFlightRepository.GetBetweenIndex(_identityService.ConnectedUser, beginIndex, endIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves tunnel flights grouped by month within a date range.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="beginDate">The start date for grouping.</param>
|
||||||
|
/// <param name="endDate">The end date for grouping.</param>
|
||||||
|
/// <returns>A collection of Statistic entities grouped by month.</returns>
|
||||||
public IEnumerable<Statistic> GetTunnelFlightGroupByMonth(string beginDate, string endDate)
|
public IEnumerable<Statistic> GetTunnelFlightGroupByMonth(string beginDate, string endDate)
|
||||||
{
|
{
|
||||||
var convertedBeginDate = Convert.ToDateTime(beginDate);
|
var convertedBeginDate = Convert.ToDateTime(beginDate);
|
||||||
@@ -69,6 +94,12 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves tunnel flights filtered by date range.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="beginDate">The start date for filtering.</param>
|
||||||
|
/// <param name="endDate">The end date for filtering.</param>
|
||||||
|
/// <returns>A collection of TunnelFlight entities filtered by the specified date range.</returns>
|
||||||
public IEnumerable<TunnelFlight> GetTunnelFlightByDates(string beginDate, string endDate)
|
public IEnumerable<TunnelFlight> GetTunnelFlightByDates(string beginDate, string endDate)
|
||||||
{
|
{
|
||||||
var convertedBeginDate = Convert.ToDateTime(beginDate);
|
var convertedBeginDate = Convert.ToDateTime(beginDate);
|
||||||
@@ -76,7 +107,13 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
return _tunnelFlightRepository.GetBetweenDate(_identityService.ConnectedUser, convertedBeginDate, convertedEndDate);
|
return _tunnelFlightRepository.GetBetweenDate(_identityService.ConnectedUser, convertedBeginDate, convertedEndDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a new tunnel flight to the system.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tunnelId">The tunnel ID to add the flight to.</param>
|
||||||
|
/// <param name="jumpTypeId">The jump type ID for the flight.</param>
|
||||||
|
/// <param name="newFlight">TunnelFlight entity containing the new flight data.</param>
|
||||||
public void AddNewFlight(int tunnelId, int jumpTypeId, TunnelFlight newFlight)
|
public void AddNewFlight(int tunnelId, int jumpTypeId, TunnelFlight newFlight)
|
||||||
{
|
{
|
||||||
var tmp = _dropZoneService.GetDzById(tunnelId);
|
var tmp = _dropZoneService.GetDzById(tunnelId);
|
||||||
@@ -93,17 +130,25 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
var selectedJumpType = _jumpTypeService.GetJumpTypeById(jumpTypeId);
|
var selectedJumpType = _jumpTypeService.GetJumpTypeById(jumpTypeId);
|
||||||
|
|
||||||
|
|
||||||
newFlight.Tunnel = selectedTunnel;
|
newFlight.Tunnel = selectedTunnel;
|
||||||
newFlight.JumpType = selectedJumpType;
|
newFlight.JumpType = selectedJumpType;
|
||||||
_tunnelFlightRepository.Add(newFlight);
|
_tunnelFlightRepository.Add(newFlight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deletes a tunnel flight by its ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The tunnel flight ID to delete.</param>
|
||||||
public void DeleteTunnelFlightById(int id)
|
public void DeleteTunnelFlightById(int id)
|
||||||
{
|
{
|
||||||
_tunnelFlightRepository.DeleteById(id);
|
_tunnelFlightRepository.DeleteById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates an existing tunnel flight.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The tunnel flight ID to update.</param>
|
||||||
|
/// <param name="updatedTunnelFlight">TunnelFlight entity containing the updated tunnel flight data.</param>
|
||||||
public void UpdateTunnelFlight(int id, TunnelFlight updatedTunnelFlight)
|
public void UpdateTunnelFlight(int id, TunnelFlight updatedTunnelFlight)
|
||||||
{
|
{
|
||||||
var myTunnelFlight = GetTunnelFlightById(id);
|
var myTunnelFlight = GetTunnelFlightById(id);
|
||||||
@@ -125,4 +170,4 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,11 +24,20 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves all tunnels.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of Tunnel entities containing all tunnels.</returns>
|
||||||
public IEnumerable<Tunnel> GetAllTunnels()
|
public IEnumerable<Tunnel> GetAllTunnels()
|
||||||
{
|
{
|
||||||
return GetAllRefTunnels();
|
return GetAllRefTunnels();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves a tunnel by its ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The tunnel ID to retrieve.</param>
|
||||||
|
/// <returns>A Tunnel entity containing the tunnel details.</returns>
|
||||||
public Tunnel GetTunnelById(int id)
|
public Tunnel GetTunnelById(int id)
|
||||||
{
|
{
|
||||||
var allTunnels = GetAllRefTunnels();
|
var allTunnels = GetAllRefTunnels();
|
||||||
@@ -70,4 +79,4 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,27 +21,49 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a new image to the system.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="newImage">The UserImage entity containing the new image data.</param>
|
||||||
public void AddNewImage(UserImage newImage)
|
public void AddNewImage(UserImage newImage)
|
||||||
{
|
{
|
||||||
newImage.User = _identityService.ConnectedUser;
|
newImage.User = _identityService.ConnectedUser;
|
||||||
_imageRepository.Add(newImage);
|
_imageRepository.Add(newImage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deletes an image by its ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The image ID to delete.</param>
|
||||||
public void DeleteImageById(int id)
|
public void DeleteImageById(int id)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves all images.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of UserImage entities containing all images.</returns>
|
||||||
public IEnumerable<UserImage> GetAllImages()
|
public IEnumerable<UserImage> GetAllImages()
|
||||||
{
|
{
|
||||||
return _imageRepository.GetAll(_identityService.ConnectedUser);
|
return _imageRepository.GetAll(_identityService.ConnectedUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves an image by its ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The image ID to retrieve.</param>
|
||||||
|
/// <returns>A UserImage entity containing the image details.</returns>
|
||||||
public UserImage GetImageById(int id)
|
public UserImage GetImageById(int id)
|
||||||
{
|
{
|
||||||
return _imageRepository.GetById(id);
|
return _imageRepository.GetById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates an existing image.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The image ID to update.</param>
|
||||||
|
/// <param name="Image">UserImage entity containing the updated image data.</param>
|
||||||
public void UpdateImage(int id, UserImage Image)
|
public void UpdateImage(int id, UserImage Image)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
@@ -56,4 +78,4 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,11 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a new user to the system.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="newUser">The User entity containing the new user data.</param>
|
||||||
|
/// <param name="isAdmin">Whether the new user should have admin privileges.</param>
|
||||||
public bool AddNewUser(User newUser, bool isAdmin = false)
|
public bool AddNewUser(User newUser, bool isAdmin = false)
|
||||||
{
|
{
|
||||||
newUser.Password = EncryptPassword(newUser.Password);
|
newUser.Password = EncryptPassword(newUser.Password);
|
||||||
@@ -45,11 +50,22 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves a user by their ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userId">The user ID to retrieve.</param>
|
||||||
|
/// <returns>A User entity containing the user details.</returns>
|
||||||
public User GetById(int userId)
|
public User GetById(int userId)
|
||||||
{
|
{
|
||||||
return _userRepository.GetById(userId);
|
return _userRepository.GetById(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves a user by their login and password.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="login">The login name of the user.</param>
|
||||||
|
/// <param name="password">The password to verify the user.</param>
|
||||||
|
/// <returns>A User entity containing the user details.</returns>
|
||||||
public User GetByLogin(string login, string password)
|
public User GetByLogin(string login, string password)
|
||||||
{
|
{
|
||||||
return _userRepository.GetByLogin(login, EncryptPassword(password));
|
return _userRepository.GetByLogin(login, EncryptPassword(password));
|
||||||
@@ -69,7 +85,7 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
{
|
{
|
||||||
Rfc2898DeriveBytes pdb = new Rfc2898DeriveBytes(encryptionKey,
|
Rfc2898DeriveBytes pdb = new Rfc2898DeriveBytes(encryptionKey,
|
||||||
new byte[] { 0x49, 0x76, 0x61, 0x6e, 0x20, 0x4d, 0x65, 0x64, 0x76, 0x65, 0x64, 0x65, 0x76 },
|
new byte[] { 0x49, 0x76, 0x61, 0x6e, 0x20, 0x4d, 0x65, 0x64, 0x76, 0x65, 0x64, 0x65, 0x76 },
|
||||||
3,
|
3,
|
||||||
HashAlgorithmName.SHA256);
|
HashAlgorithmName.SHA256);
|
||||||
encryptor.Key = pdb.GetBytes(32);
|
encryptor.Key = pdb.GetBytes(32);
|
||||||
encryptor.IV = pdb.GetBytes(16);
|
encryptor.IV = pdb.GetBytes(16);
|
||||||
@@ -97,4 +113,4 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
using LiteDB;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using LiteDB;
|
||||||
using skydiveLogs_api.Domain;
|
using skydiveLogs_api.Domain;
|
||||||
using skydiveLogs_api.DomainService.Repositories;
|
using skydiveLogs_api.DomainService.Repositories;
|
||||||
using skydiveLogs_api.Infrastructure.Interfaces;
|
using skydiveLogs_api.Infrastructure.Interfaces;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace skydiveLogs_api.Infrastructure
|
namespace skydiveLogs_api.Infrastructure
|
||||||
{
|
{
|
||||||
@@ -11,6 +12,14 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
{
|
{
|
||||||
#region Public Constructors
|
#region Public Constructors
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="AircraftRepository"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dataProvider">The data provider used for database access operations</param>
|
||||||
|
/// <remarks>
|
||||||
|
/// This constructor initializes the repository with a reference to the data provider
|
||||||
|
/// and sets up the collection for aircraft data operations.
|
||||||
|
/// </remarks>
|
||||||
public AircraftRepository(IDataProvider dataProvider)
|
public AircraftRepository(IDataProvider dataProvider)
|
||||||
{
|
{
|
||||||
_dataProvider = dataProvider;
|
_dataProvider = dataProvider;
|
||||||
@@ -21,6 +30,15 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a new aircraft to the database.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="newAircraft">The aircraft instance to insert into the database</param>
|
||||||
|
/// <returns>The number of rows affected. Returns 0 if the insert operation failed.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// Attempts to insert the new aircraft into the database using LiteDB.
|
||||||
|
/// If an exception occurs during insertion, the method returns 0.
|
||||||
|
/// </remarks>
|
||||||
public int Add(Aircraft newAircraft)
|
public int Add(Aircraft newAircraft)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
@@ -38,21 +56,55 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves all aircraft from the database.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>An enumerable collection containing all aircraft instances stored in the database</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// Queries the aircraft collection and retrieves all records,
|
||||||
|
/// then converts the result to a List for enumeration.
|
||||||
|
/// </remarks>
|
||||||
public IEnumerable<Aircraft> GetAll()
|
public IEnumerable<Aircraft> GetAll()
|
||||||
{
|
{
|
||||||
return _col.FindAll().ToList();
|
return _col.FindAll().ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves an aircraft by its unique identifier.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The unique identifier of the aircraft to retrieve</param>
|
||||||
|
/// <returns>The aircraft instance if found, otherwise null</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// Searches the aircraft collection for a record with the specified ID
|
||||||
|
/// and returns the found aircraft or null if no match exists.
|
||||||
|
/// </remarks>
|
||||||
public Aircraft GetById(int id)
|
public Aircraft GetById(int id)
|
||||||
{
|
{
|
||||||
return _col.FindById(new BsonValue(id));
|
return _col.FindById(new BsonValue(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the total count of aircraft in the database.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The total number of aircraft stored in the database</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method is not currently implemented and throws
|
||||||
|
/// a <see cref="NotImplementedException"/> when called.
|
||||||
|
/// </remarks>
|
||||||
public int GetCount()
|
public int GetCount()
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates an existing aircraft in the database.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="aircraft">The aircraft instance containing the updated data</param>
|
||||||
|
/// <returns><see langword="true"/> if the update was successful; otherwise, <see langword="false"/></returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// Updates the aircraft record in the database with the provided aircraft instance.
|
||||||
|
/// The method returns the result of the underlying LiteDB update operation.
|
||||||
|
/// </remarks>
|
||||||
public bool Update(Aircraft aircraft)
|
public bool Update(Aircraft aircraft)
|
||||||
{
|
{
|
||||||
return _col.Update(aircraft);
|
return _col.Update(aircraft);
|
||||||
@@ -62,9 +114,16 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
|
|
||||||
#region Private Fields
|
#region Private Fields
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The LiteDB collection for aircraft records.
|
||||||
|
/// </summary>
|
||||||
private readonly ILiteCollection<Aircraft> _col;
|
private readonly ILiteCollection<Aircraft> _col;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The data provider used for database access operations.
|
||||||
|
/// </summary>
|
||||||
private readonly IDataProvider _dataProvider;
|
private readonly IDataProvider _dataProvider;
|
||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
using LiteDB;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using LiteDB;
|
||||||
using skydiveLogs_api.Domain;
|
using skydiveLogs_api.Domain;
|
||||||
using skydiveLogs_api.DomainService.Repositories;
|
using skydiveLogs_api.DomainService.Repositories;
|
||||||
using skydiveLogs_api.Infrastructure.Interfaces;
|
using skydiveLogs_api.Infrastructure.Interfaces;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace skydiveLogs_api.Infrastructure
|
namespace skydiveLogs_api.Infrastructure
|
||||||
{
|
{
|
||||||
@@ -11,6 +12,15 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
{
|
{
|
||||||
#region Public Constructors
|
#region Public Constructors
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="DropZoneRepository"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dataProvider">The data provider used for database access operations.</param>
|
||||||
|
/// <remarks>
|
||||||
|
/// 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.
|
||||||
|
/// </remarks>
|
||||||
public DropZoneRepository(IDataProvider dataProvider)
|
public DropZoneRepository(IDataProvider dataProvider)
|
||||||
{
|
{
|
||||||
_dataProvider = dataProvider;
|
_dataProvider = dataProvider;
|
||||||
@@ -21,13 +31,23 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
public int Add(DropZone newDz)
|
/// <summary>
|
||||||
|
/// Adds a new drop zone to the database.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="newDropZone">The drop zone instance to insert into the database.</param>
|
||||||
|
/// <returns>The number of rows affected. Returns 0 if the insert operation failed.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// 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.
|
||||||
|
/// </remarks>
|
||||||
|
public int Add(DropZone newDropZone)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var tmp = _col.Insert(newDz);
|
var tmp = _col.Insert(newDropZone);
|
||||||
result = tmp.AsInt32;
|
result = tmp.AsInt32;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
@@ -38,33 +58,80 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves all drop zones from the database.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>An enumerable collection containing all drop zone instances stored in the database.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// 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.
|
||||||
|
/// </remarks>
|
||||||
public IEnumerable<DropZone> GetAll()
|
public IEnumerable<DropZone> GetAll()
|
||||||
{
|
{
|
||||||
return _col.FindAll().ToList();
|
return _col.FindAll().ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves a drop zone by its unique identifier.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The unique identifier of the drop zone to retrieve.</param>
|
||||||
|
/// <returns>The drop zone instance if found, otherwise null.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// 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 <see cref="GetAll"/> to retrieve all drop zones or filter by criteria.
|
||||||
|
/// </remarks>
|
||||||
public DropZone GetById(int id)
|
public DropZone GetById(int id)
|
||||||
{
|
{
|
||||||
return _col.FindById(new BsonValue(id));
|
return _col.FindById(new BsonValue(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the total count of drop zones in the database.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The total number of drop zones stored in the database.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method is not currently implemented and throws
|
||||||
|
/// a <see cref="NotImplementedException"/> when called.
|
||||||
|
/// Implement this method to retrieve the count of all drop zones.
|
||||||
|
/// </remarks>
|
||||||
|
/// <exception cref="NotImplementedException">Thrown when the count is requested.</exception>
|
||||||
public int GetCount()
|
public int GetCount()
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Update(DropZone updatedDz)
|
/// <summary>
|
||||||
|
/// Updates an existing drop zone in the database.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dropZone">The drop zone instance containing the updated data.</param>
|
||||||
|
/// <returns><see langword="true"/> if the update was successful; otherwise, <see langword="false"/>.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// 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.
|
||||||
|
/// </remarks>
|
||||||
|
public bool Update(DropZone dropZone)
|
||||||
{
|
{
|
||||||
return _col.Update(updatedDz);
|
return _col.Update(dropZone);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Public Methods
|
#endregion Public Methods
|
||||||
|
|
||||||
#region Private Fields
|
#region Private Fields
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The LiteDB collection for drop zone records.
|
||||||
|
/// </summary>
|
||||||
private readonly ILiteCollection<DropZone> _col;
|
private readonly ILiteCollection<DropZone> _col;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The data provider used for database access operations.
|
||||||
|
/// </summary>
|
||||||
private readonly IDataProvider _dataProvider;
|
private readonly IDataProvider _dataProvider;
|
||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
using LiteDB;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using LiteDB;
|
||||||
using skydiveLogs_api.Domain;
|
using skydiveLogs_api.Domain;
|
||||||
using skydiveLogs_api.DomainService.Repositories;
|
using skydiveLogs_api.DomainService.Repositories;
|
||||||
using skydiveLogs_api.Infrastructure.Interfaces;
|
using skydiveLogs_api.Infrastructure.Interfaces;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace skydiveLogs_api.Infrastructure
|
namespace skydiveLogs_api.Infrastructure
|
||||||
{
|
{
|
||||||
@@ -10,6 +11,16 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
{
|
{
|
||||||
#region Public Constructors
|
#region Public Constructors
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="FavoriteDropZoneRepository"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dataProvider">The data provider used for database access operations.</param>
|
||||||
|
/// <remarks>
|
||||||
|
/// 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.
|
||||||
|
/// </remarks>
|
||||||
public FavoriteDropZoneRepository(IDataProvider dataProvider)
|
public FavoriteDropZoneRepository(IDataProvider dataProvider)
|
||||||
{
|
{
|
||||||
_dataProvider = dataProvider;
|
_dataProvider = dataProvider;
|
||||||
@@ -20,6 +31,16 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a new favorite drop zone to the database.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="favoriteToAdd">The favorite drop zone instance to insert into the database.</param>
|
||||||
|
/// <returns>The number of rows affected. Returns 0 if the insert operation failed.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// 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.
|
||||||
|
/// </remarks>
|
||||||
public int Add(FavoriteDropZone favoriteToAdd)
|
public int Add(FavoriteDropZone favoriteToAdd)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
@@ -37,11 +58,31 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deletes favorite drop zone entries by drop zone ID and user ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dropZoneId">The unique identifier of the drop zone to delete favorites for.</param>
|
||||||
|
/// <param name="userId">The unique identifier of the user whose favorites to delete.</param>
|
||||||
|
/// <returns>The number of rows affected. Returns 0 if the delete operation failed or no records matched.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// 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.
|
||||||
|
/// </remarks>
|
||||||
public int Delete(int dropZoneId, int userId)
|
public int Delete(int dropZoneId, int userId)
|
||||||
{
|
{
|
||||||
return _col.DeleteMany(d => d.DropZone.Id == dropZoneId && d.User.Id == 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>An enumerable collection containing all favorite drop zone instances belonging to the specified user.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// 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.
|
||||||
|
/// </remarks>
|
||||||
public IEnumerable<FavoriteDropZone> GetAll(User user)
|
public IEnumerable<FavoriteDropZone> GetAll(User user)
|
||||||
{
|
{
|
||||||
return _col.Query()
|
return _col.Query()
|
||||||
@@ -49,33 +90,81 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves all favorite drop zones from the database.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>An enumerable collection containing all favorite drop zone instances in the database.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method is not currently implemented and throws a <see cref="NotImplementedException"/> when called.
|
||||||
|
/// Implement this method to retrieve all favorite drop zones across all users in the system.
|
||||||
|
/// </remarks>
|
||||||
|
/// <exception cref="NotImplementedException">Thrown when the method is called.</exception>
|
||||||
public IEnumerable<FavoriteDropZone> GetAll()
|
public IEnumerable<FavoriteDropZone> GetAll()
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves a favorite drop zone by its unique identifier.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The unique identifier of the favorite drop zone to retrieve.</param>
|
||||||
|
/// <returns>The favorite drop zone instance if found, otherwise null.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// 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.
|
||||||
|
/// </remarks>
|
||||||
|
/// <exception cref="NotImplementedException">Thrown when attempting to retrieve by ID.</exception>
|
||||||
public FavoriteDropZone GetById(int id)
|
public FavoriteDropZone GetById(int id)
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the total count of favorite drop zones for a specific user.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="user">The user whose favorite drop zones to count.</param>
|
||||||
|
/// <returns>The total number of favorite drop zones for the specified user.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method is not currently implemented and throws a <see cref="NotImplementedException"/> when called.
|
||||||
|
/// Implement this method to retrieve the count of favorite drop zones per user.
|
||||||
|
/// </remarks>
|
||||||
|
/// <exception cref="NotImplementedException">Thrown when the method is called.</exception>
|
||||||
public int GetCount()
|
public int GetCount()
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates an existing favorite drop zone in the database.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="updated">The favorite drop zone instance containing the updated data.</param>
|
||||||
|
/// <returns><see langword="true"/> if the update was successful; otherwise, <see langword="false"/>.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method is not currently implemented and throws a <see cref="NotImplementedException"/> 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.
|
||||||
|
/// </remarks>
|
||||||
|
/// <exception cref="NotImplementedException">Thrown when attempting to update.</exception>
|
||||||
public bool Update(FavoriteDropZone updated)
|
public bool Update(FavoriteDropZone updated)
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Public Methods
|
#endregion Public Methods
|
||||||
|
|
||||||
#region Private Fields
|
#region Private Fields
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The LiteDB collection for favorite drop zone records.
|
||||||
|
/// </summary>
|
||||||
private readonly ILiteCollection<FavoriteDropZone> _col;
|
private readonly ILiteCollection<FavoriteDropZone> _col;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The data provider used for database access operations.
|
||||||
|
/// </summary>
|
||||||
private readonly IDataProvider _dataProvider;
|
private readonly IDataProvider _dataProvider;
|
||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
using LiteDB;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using LiteDB;
|
||||||
using skydiveLogs_api.Domain;
|
using skydiveLogs_api.Domain;
|
||||||
using skydiveLogs_api.DomainService.Repositories;
|
using skydiveLogs_api.DomainService.Repositories;
|
||||||
using skydiveLogs_api.Infrastructure.Interfaces;
|
using skydiveLogs_api.Infrastructure.Interfaces;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace skydiveLogs_api.Infrastructure
|
namespace skydiveLogs_api.Infrastructure
|
||||||
{
|
{
|
||||||
@@ -10,6 +11,16 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
{
|
{
|
||||||
#region Public Constructors
|
#region Public Constructors
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="GearRepository"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dataProvider">The data provider used for database access operations.</param>
|
||||||
|
/// <remarks>
|
||||||
|
/// 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.
|
||||||
|
/// </remarks>
|
||||||
public GearRepository(IDataProvider dataProvider)
|
public GearRepository(IDataProvider dataProvider)
|
||||||
{
|
{
|
||||||
_dataProvider = dataProvider;
|
_dataProvider = dataProvider;
|
||||||
@@ -20,6 +31,17 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a new gear item to the database.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="newGear">The gear instance to insert into the database.</param>
|
||||||
|
/// <returns>The number of rows affected. Returns 0 if the insert operation failed.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// 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.
|
||||||
|
/// </remarks>
|
||||||
public int Add(Gear newGear)
|
public int Add(Gear newGear)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
@@ -37,11 +59,30 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves all gear items from the database.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>An enumerable collection containing all gear instances stored in the database.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method is not currently implemented and throws a <see cref="NotImplementedException"/> when called.
|
||||||
|
/// Implement this method to retrieve all gear records from the database, potentially filtered by user.
|
||||||
|
/// </remarks>
|
||||||
|
/// <exception cref="NotImplementedException">Thrown when the method is called.</exception>
|
||||||
public IEnumerable<Gear> GetAll()
|
public IEnumerable<Gear> GetAll()
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves all gear items for a specific user.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="user">The user whose gear items to retrieve.</param>
|
||||||
|
/// <returns>An enumerable collection containing all gear instances belonging to the specified user.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// 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.
|
||||||
|
/// </remarks>
|
||||||
public IEnumerable<Gear> GetAll(User user)
|
public IEnumerable<Gear> GetAll(User user)
|
||||||
{
|
{
|
||||||
return _col.Include(x => x.User)
|
return _col.Include(x => x.User)
|
||||||
@@ -50,16 +91,46 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves a gear item by its unique identifier.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The unique identifier of the gear item to retrieve.</param>
|
||||||
|
/// <returns>The gear item instance if found, otherwise null.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// 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.
|
||||||
|
/// </remarks>
|
||||||
public Gear GetById(int id)
|
public Gear GetById(int id)
|
||||||
{
|
{
|
||||||
return _col.FindById(new BsonValue(id));
|
return _col.FindById(new BsonValue(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the total count of gear items for a specific user.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="user">The user whose gear items to count.</param>
|
||||||
|
/// <returns>The total number of gear items for the specified user.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method is not currently implemented and throws a <see cref="NotImplementedException"/> when called.
|
||||||
|
/// Implement this method to retrieve the count of gear items per user.
|
||||||
|
/// </remarks>
|
||||||
|
/// <exception cref="NotImplementedException">Thrown when the method is called.</exception>
|
||||||
public int GetCount()
|
public int GetCount()
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates an existing gear item in the database.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="updatedGear">The gear item instance containing the updated data.</param>
|
||||||
|
/// <returns><see langword="true"/> if the update was successful; otherwise, <see langword="false"/>.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// 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.
|
||||||
|
/// </remarks>
|
||||||
public bool Update(Gear updatedGear)
|
public bool Update(Gear updatedGear)
|
||||||
{
|
{
|
||||||
return _col.Update(updatedGear);
|
return _col.Update(updatedGear);
|
||||||
@@ -69,9 +140,16 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
|
|
||||||
#region Private Fields
|
#region Private Fields
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The LiteDB collection for gear records.
|
||||||
|
/// </summary>
|
||||||
private readonly ILiteCollection<Gear> _col;
|
private readonly ILiteCollection<Gear> _col;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The data provider used for database access operations.
|
||||||
|
/// </summary>
|
||||||
private readonly IDataProvider _dataProvider;
|
private readonly IDataProvider _dataProvider;
|
||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
using LiteDB;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using LiteDB;
|
||||||
using skydiveLogs_api.Domain;
|
using skydiveLogs_api.Domain;
|
||||||
using skydiveLogs_api.DomainService.Repositories;
|
using skydiveLogs_api.DomainService.Repositories;
|
||||||
using skydiveLogs_api.Infrastructure.Interfaces;
|
using skydiveLogs_api.Infrastructure.Interfaces;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace skydiveLogs_api.Infrastructure
|
namespace skydiveLogs_api.Infrastructure
|
||||||
{
|
{
|
||||||
@@ -10,6 +11,16 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
{
|
{
|
||||||
#region Public Constructors
|
#region Public Constructors
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="JumpRepository"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dataProvider">The data provider used for database access operations.</param>
|
||||||
|
/// <remarks>
|
||||||
|
/// 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.
|
||||||
|
/// </remarks>
|
||||||
public JumpRepository(IDataProvider dataProvider)
|
public JumpRepository(IDataProvider dataProvider)
|
||||||
{
|
{
|
||||||
_dataProvider = dataProvider;
|
_dataProvider = dataProvider;
|
||||||
@@ -20,6 +31,17 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a new jump record to the database.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="newJump">The jump instance to insert into the database.</param>
|
||||||
|
/// <returns>The number of rows affected. Returns 0 if the insert operation failed.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// 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.
|
||||||
|
/// </remarks>
|
||||||
public int Add(Jump newJump)
|
public int Add(Jump newJump)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
@@ -37,11 +59,31 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deletes a jump record by its unique identifier.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The unique identifier of the jump to delete.</param>
|
||||||
|
/// <returns><see langword="true"/> if the deletion was successful; otherwise, <see langword="false"/>.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// Deletes the jump record with the specified ID from the database.
|
||||||
|
/// The method uses the <see cref="ILiteCollection{T}.Delete"/> method to remove the record.
|
||||||
|
/// </remarks>
|
||||||
public bool DeleteById(int id)
|
public bool DeleteById(int id)
|
||||||
{
|
{
|
||||||
return _col.Delete(new BsonValue(id));
|
return _col.Delete(new BsonValue(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves all jump records for a specific user.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="user">The user whose jump records to retrieve.</param>
|
||||||
|
/// <returns>An enumerable collection containing all jump records belonging to the specified user.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// 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.
|
||||||
|
/// </remarks>
|
||||||
public IEnumerable<Jump> GetAll(User user)
|
public IEnumerable<Jump> GetAll(User user)
|
||||||
{
|
{
|
||||||
return _col.Include(x => x.Aircraft)
|
return _col.Include(x => x.Aircraft)
|
||||||
@@ -51,11 +93,32 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
.Find(j => j.User.Id == user.Id);
|
.Find(j => j.User.Id == user.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves all jump records from the database.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>An enumerable collection containing all jump records stored in the database.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method is not currently implemented and throws a <see cref="NotImplementedException"/> when called.
|
||||||
|
/// Implement this method to retrieve all jump records from the database without filtering.
|
||||||
|
/// </remarks>
|
||||||
|
/// <exception cref="NotImplementedException">Thrown when the method is called.</exception>
|
||||||
public IEnumerable<Jump> GetAll()
|
public IEnumerable<Jump> GetAll()
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves a range of jump records for a specific user with pagination.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="user">The user whose jump records to retrieve.</param>
|
||||||
|
/// <param name="beginIndex">The starting index for pagination (inclusive).</param>
|
||||||
|
/// <param name="endIndex">The ending index for pagination (exclusive).</param>
|
||||||
|
/// <returns>An enumerable collection containing the requested range of jump records.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// 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.
|
||||||
|
/// </remarks>
|
||||||
public IEnumerable<Jump> GetBetweenIndex(User user, int beginIndex, int endIndex)
|
public IEnumerable<Jump> GetBetweenIndex(User user, int beginIndex, int endIndex)
|
||||||
{
|
{
|
||||||
return _col.Include(x => x.Aircraft)
|
return _col.Include(x => x.Aircraft)
|
||||||
@@ -70,21 +133,60 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves a jump record by its unique identifier.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The unique identifier of the jump to retrieve.</param>
|
||||||
|
/// <returns>The jump record instance if found, otherwise null.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// 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.
|
||||||
|
/// </remarks>
|
||||||
public Jump GetById(int id)
|
public Jump GetById(int id)
|
||||||
{
|
{
|
||||||
return _col.FindById(new BsonValue(id));
|
return _col.FindById(new BsonValue(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the total count of jump records for a specific user.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="user">The user whose jump records to count.</param>
|
||||||
|
/// <returns>The total number of jump records for the specified user.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method is not currently implemented and throws a <see cref="NotImplementedException"/> when called.
|
||||||
|
/// Implement this method to retrieve the count of jump records per user.
|
||||||
|
/// </remarks>
|
||||||
|
/// <exception cref="NotImplementedException">Thrown when the method is called.</exception>
|
||||||
public int GetCount(User user)
|
public int GetCount(User user)
|
||||||
{
|
{
|
||||||
return _col.Count(j => j.User.Id == user.Id);
|
return _col.Count(j => j.User.Id == user.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the total count of jump records in the database.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The total number of jump records stored in the database.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method is not currently implemented and throws a <see cref="NotImplementedException"/> when called.
|
||||||
|
/// Implement this method to retrieve the count of all jump records.
|
||||||
|
/// </remarks>
|
||||||
|
/// <exception cref="NotImplementedException">Thrown when the method is called.</exception>
|
||||||
public int GetCount()
|
public int GetCount()
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates an existing jump record in the database.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="updatedJump">The jump record instance containing the updated data.</param>
|
||||||
|
/// <returns><see langword="true"/> if the update was successful; otherwise, <see langword="false"/>.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// 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.
|
||||||
|
/// </remarks>
|
||||||
public bool Update(Jump updatedJump)
|
public bool Update(Jump updatedJump)
|
||||||
{
|
{
|
||||||
return _col.Update(updatedJump);
|
return _col.Update(updatedJump);
|
||||||
@@ -94,9 +196,16 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
|
|
||||||
#region Private Fields
|
#region Private Fields
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The LiteDB collection for jump records.
|
||||||
|
/// </summary>
|
||||||
private readonly ILiteCollection<Jump> _col;
|
private readonly ILiteCollection<Jump> _col;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The data provider used for database access operations.
|
||||||
|
/// </summary>
|
||||||
private readonly IDataProvider _dataProvider;
|
private readonly IDataProvider _dataProvider;
|
||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
using LiteDB;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using LiteDB;
|
||||||
using skydiveLogs_api.Domain;
|
using skydiveLogs_api.Domain;
|
||||||
using skydiveLogs_api.DomainService.Repositories;
|
using skydiveLogs_api.DomainService.Repositories;
|
||||||
using skydiveLogs_api.Infrastructure.Interfaces;
|
using skydiveLogs_api.Infrastructure.Interfaces;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace skydiveLogs_api.Infrastructure
|
namespace skydiveLogs_api.Infrastructure
|
||||||
{
|
{
|
||||||
@@ -11,6 +12,16 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
{
|
{
|
||||||
#region Public Constructors
|
#region Public Constructors
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="JumpTypeRepository"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dataProvider">The data provider used for database access operations.</param>
|
||||||
|
/// <remarks>
|
||||||
|
/// 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.
|
||||||
|
/// </remarks>
|
||||||
public JumpTypeRepository(IDataProvider dataProvider)
|
public JumpTypeRepository(IDataProvider dataProvider)
|
||||||
{
|
{
|
||||||
_dataProvider = dataProvider;
|
_dataProvider = dataProvider;
|
||||||
@@ -21,6 +32,17 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a new jump type to the database.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="newJumpType">The jump type instance to insert into the database.</param>
|
||||||
|
/// <returns>The number of rows affected. Returns 0 if the insert operation failed.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// 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.
|
||||||
|
/// </remarks>
|
||||||
public int Add(JumpType newJumpType)
|
public int Add(JumpType newJumpType)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
@@ -38,21 +60,59 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves all jump types from the database.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>An enumerable collection containing all jump type instances stored in the database.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// 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.
|
||||||
|
/// </remarks>
|
||||||
public IEnumerable<JumpType> GetAll()
|
public IEnumerable<JumpType> GetAll()
|
||||||
{
|
{
|
||||||
return _col.FindAll().ToList();
|
return _col.FindAll().ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves a jump type by its unique identifier.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The unique identifier of the jump type to retrieve.</param>
|
||||||
|
/// <returns>The jump type instance if found, otherwise null.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// 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.
|
||||||
|
/// </remarks>
|
||||||
public JumpType GetById(int id)
|
public JumpType GetById(int id)
|
||||||
{
|
{
|
||||||
return _col.FindById(new BsonValue(id));
|
return _col.FindById(new BsonValue(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the total count of jump types in the database.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The total number of jump types stored in the database.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method is not currently implemented and throws a <see cref="NotImplementedException"/> when called.
|
||||||
|
/// Implement this method to retrieve the count of all jump type records in the database.
|
||||||
|
/// </remarks>
|
||||||
|
/// <exception cref="NotImplementedException">Thrown when the method is called.</exception>
|
||||||
public int GetCount()
|
public int GetCount()
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates an existing jump type in the database.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="updatedJumpType">The jump type instance containing the updated data.</param>
|
||||||
|
/// <returns><see langword="true"/> if the update was successful; otherwise, <see langword="false"/>.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// 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.
|
||||||
|
/// </remarks>
|
||||||
public bool Update(JumpType updatedJumpType)
|
public bool Update(JumpType updatedJumpType)
|
||||||
{
|
{
|
||||||
return _col.Update(updatedJumpType);
|
return _col.Update(updatedJumpType);
|
||||||
@@ -62,9 +122,16 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
|
|
||||||
#region Private Fields
|
#region Private Fields
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The LiteDB collection for jump type records.
|
||||||
|
/// </summary>
|
||||||
private readonly ILiteCollection<JumpType> _col;
|
private readonly ILiteCollection<JumpType> _col;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The data provider used for database access operations.
|
||||||
|
/// </summary>
|
||||||
private readonly IDataProvider _dataProvider;
|
private readonly IDataProvider _dataProvider;
|
||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,10 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
{
|
{
|
||||||
#region Public Constructors
|
#region Public Constructors
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="StatsByDzRepository"/> class
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dataProvider">The data provider to use for data access</param>
|
||||||
public StatsByDzRepository(IDataProvider dataProvider)
|
public StatsByDzRepository(IDataProvider dataProvider)
|
||||||
{
|
{
|
||||||
_dataProvider = dataProvider;
|
_dataProvider = dataProvider;
|
||||||
@@ -20,6 +24,11 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a new collection of stats by drop zone to the database
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="newStats">The collection of stats by drop zone instances to add</param>
|
||||||
|
/// <returns>The number of rows affected</returns>
|
||||||
public int Add(IEnumerable<StatsByDz> newStats)
|
public int Add(IEnumerable<StatsByDz> newStats)
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
@@ -40,6 +49,11 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves all stats by drop zone for a specific user
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="user">The user whose stats by drop zone to retrieve</param>
|
||||||
|
/// <returns>A collection of stats by drop zone instances belonging to the user</returns>
|
||||||
public IEnumerable<StatsByDz> GetAll(User user)
|
public IEnumerable<StatsByDz> GetAll(User user)
|
||||||
{
|
{
|
||||||
return _col.Include(x => x.User)
|
return _col.Include(x => x.User)
|
||||||
@@ -48,6 +62,12 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates existing stats by drop zone in the database
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="updatedStats">The stats by drop zone instances to update</param>
|
||||||
|
/// <param name="user">The user whose stats to update</param>
|
||||||
|
/// <returns>True if the update was successful, false otherwise</returns>
|
||||||
public bool Update(IEnumerable<StatsByDz> updatedStats, User user)
|
public bool Update(IEnumerable<StatsByDz> updatedStats, User user)
|
||||||
{
|
{
|
||||||
Delete(user);
|
Delete(user);
|
||||||
@@ -56,6 +76,11 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
return tmp != 0;
|
return tmp != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deletes all stats by drop zone for a specific user
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="user">The user whose stats by drop zone to delete</param>
|
||||||
|
/// <returns>True if the delete was successful, false otherwise</returns>
|
||||||
public bool Delete(User user)
|
public bool Delete(User user)
|
||||||
{
|
{
|
||||||
var tmp = _col.DeleteMany(s => s.User.Id == user.Id);
|
var tmp = _col.DeleteMany(s => s.User.Id == user.Id);
|
||||||
@@ -71,4 +96,4 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,10 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
{
|
{
|
||||||
#region Public Constructors
|
#region Public Constructors
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="StatsByGearRepository"/> class
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dataProvider">The data provider to use for data access</param>
|
||||||
public StatsByGearRepository(IDataProvider dataProvider)
|
public StatsByGearRepository(IDataProvider dataProvider)
|
||||||
{
|
{
|
||||||
_dataProvider = dataProvider;
|
_dataProvider = dataProvider;
|
||||||
@@ -20,6 +24,11 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a new collection of stats by gear to the database
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="newStats">The collection of stats by gear instances to add</param>
|
||||||
|
/// <returns>The number of rows affected</returns>
|
||||||
public int Add(IEnumerable<StatsByGear> newStats)
|
public int Add(IEnumerable<StatsByGear> newStats)
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
@@ -40,6 +49,11 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves all stats by gear for a specific user
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="user">The user whose stats by gear to retrieve</param>
|
||||||
|
/// <returns>A collection of stats by gear instances belonging to the user</returns>
|
||||||
public IEnumerable<StatsByGear> GetAll(User user)
|
public IEnumerable<StatsByGear> GetAll(User user)
|
||||||
{
|
{
|
||||||
return _col.Include(x => x.User)
|
return _col.Include(x => x.User)
|
||||||
@@ -48,6 +62,12 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates existing stats by gear in the database
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="updatedStats">The stats by gear instances to update</param>
|
||||||
|
/// <param name="user">The user whose stats to update</param>
|
||||||
|
/// <returns>True if the update was successful, false otherwise</returns>
|
||||||
public bool Update(IEnumerable<StatsByGear> updatedStats, User user)
|
public bool Update(IEnumerable<StatsByGear> updatedStats, User user)
|
||||||
{
|
{
|
||||||
Delete(user);
|
Delete(user);
|
||||||
@@ -56,6 +76,11 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
return tmp != 0;
|
return tmp != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deletes all stats by gear for a specific user
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="user">The user whose stats by gear to delete</param>
|
||||||
|
/// <returns>True if the delete was successful, false otherwise</returns>
|
||||||
public bool Delete(User user)
|
public bool Delete(User user)
|
||||||
{
|
{
|
||||||
var tmp = _col.DeleteMany(s => s.User.Id == user.Id);
|
var tmp = _col.DeleteMany(s => s.User.Id == user.Id);
|
||||||
@@ -71,4 +96,4 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
using LiteDB;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using LiteDB;
|
||||||
using skydiveLogs_api.Domain;
|
using skydiveLogs_api.Domain;
|
||||||
using skydiveLogs_api.DomainService.Repositories;
|
using skydiveLogs_api.DomainService.Repositories;
|
||||||
using skydiveLogs_api.Infrastructure.Interfaces;
|
using skydiveLogs_api.Infrastructure.Interfaces;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace skydiveLogs_api.Infrastructure
|
namespace skydiveLogs_api.Infrastructure
|
||||||
{
|
{
|
||||||
@@ -21,6 +21,11 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a new tunnel flight to the database.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="newTunnelFlight">The tunnel flight instance to insert into the database.</param>
|
||||||
|
/// <returns>The number of rows affected. Returns 0 if the insert operation failed.</returns>
|
||||||
public int Add(TunnelFlight newTunnelFlight)
|
public int Add(TunnelFlight newTunnelFlight)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
@@ -38,11 +43,21 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deletes a tunnel flight by its unique identifier.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The unique identifier of the tunnel flight to delete.</param>
|
||||||
|
/// <returns><see langword="true"/> if the deletion was successful; otherwise, <see langword="false"/>.</returns>
|
||||||
public bool DeleteById(int id)
|
public bool DeleteById(int id)
|
||||||
{
|
{
|
||||||
return _col.Delete(new BsonValue(id));
|
return _col.Delete(new BsonValue(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves all tunnel flights for a specific user.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="user">The user whose tunnel flight records to retrieve.</param>
|
||||||
|
/// <returns>An enumerable collection containing all tunnel flight records belonging to the specified user.</returns>
|
||||||
public IEnumerable<TunnelFlight> GetAll(User user)
|
public IEnumerable<TunnelFlight> GetAll(User user)
|
||||||
{
|
{
|
||||||
return _col.Include(x => x.Tunnel)
|
return _col.Include(x => x.Tunnel)
|
||||||
@@ -50,11 +65,22 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
.Find(j => j.User.Id == user.Id);
|
.Find(j => j.User.Id == user.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves all tunnel flights from the database.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>An enumerable collection containing all tunnel flight records stored in the database.</returns>
|
||||||
public IEnumerable<TunnelFlight> GetAll()
|
public IEnumerable<TunnelFlight> GetAll()
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
throw new System.NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves a range of tunnel flights for a specific user with pagination.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="user">The user whose tunnel flight records to retrieve.</param>
|
||||||
|
/// <param name="beginIndex">The starting index for pagination (inclusive).</param>
|
||||||
|
/// <param name="endIndex">The ending index for pagination (exclusive).</param>
|
||||||
|
/// <returns>An enumerable collection containing the requested range of tunnel flight records.</returns>
|
||||||
public IEnumerable<TunnelFlight> GetBetweenIndex(User user, int beginIndex, int endIndex)
|
public IEnumerable<TunnelFlight> GetBetweenIndex(User user, int beginIndex, int endIndex)
|
||||||
{
|
{
|
||||||
return _col.Include(x => x.Tunnel)
|
return _col.Include(x => x.Tunnel)
|
||||||
@@ -67,6 +93,13 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves a range of tunnel flights within a date range for a specific user.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="user">The user whose tunnel flight records to retrieve.</param>
|
||||||
|
/// <param name="beginDate">The start of the date range (inclusive).</param>
|
||||||
|
/// <param name="endDate">The end of the date range (exclusive).</param>
|
||||||
|
/// <returns>An enumerable collection containing the requested range of tunnel flight records within the specified date range.</returns>
|
||||||
public IEnumerable<TunnelFlight> GetBetweenDate(User user, DateTime beginDate, DateTime endDate)
|
public IEnumerable<TunnelFlight> GetBetweenDate(User user, DateTime beginDate, DateTime endDate)
|
||||||
{
|
{
|
||||||
return _col.Include(x => x.Tunnel)
|
return _col.Include(x => x.Tunnel)
|
||||||
@@ -78,21 +111,40 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves a tunnel flight by its unique identifier.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The unique identifier of the tunnel flight to retrieve.</param>
|
||||||
|
/// <returns>The tunnel flight record instance if found, otherwise null.</returns>
|
||||||
public TunnelFlight GetById(int id)
|
public TunnelFlight GetById(int id)
|
||||||
{
|
{
|
||||||
return _col.FindById(new BsonValue(id));
|
return _col.FindById(new BsonValue(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the total count of tunnel flights for a specific user.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="user">The user whose tunnel flight records to count.</param>
|
||||||
|
/// <returns>The total number of tunnel flight records for the specified user.</returns>
|
||||||
public int GetCount(User user)
|
public int GetCount(User user)
|
||||||
{
|
{
|
||||||
return _col.Count(j => j.User.Id == user.Id);
|
return _col.Count(j => j.User.Id == user.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the total count of tunnel flights in the database.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The total number of tunnel flight records stored in the database.</returns>
|
||||||
public int GetCount()
|
public int GetCount()
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
throw new System.NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates an existing tunnel flight record in the database.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="updatedTunnelFlight">The tunnel flight instance containing the updated data.</param>
|
||||||
|
/// <returns><see langword="true"/> if the update was successful; otherwise, <see langword="false"/>.</returns>
|
||||||
public bool Update(TunnelFlight updatedTunnelFlight)
|
public bool Update(TunnelFlight updatedTunnelFlight)
|
||||||
{
|
{
|
||||||
return _col.Update(updatedTunnelFlight);
|
return _col.Update(updatedTunnelFlight);
|
||||||
@@ -103,8 +155,9 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
#region Private Fields
|
#region Private Fields
|
||||||
|
|
||||||
private readonly ILiteCollection<TunnelFlight> _col;
|
private readonly ILiteCollection<TunnelFlight> _col;
|
||||||
|
|
||||||
private readonly IDataProvider _dataProvider;
|
private readonly IDataProvider _dataProvider;
|
||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
using LiteDB;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using LiteDB;
|
||||||
using skydiveLogs_api.Domain;
|
using skydiveLogs_api.Domain;
|
||||||
using skydiveLogs_api.DomainService.Repositories;
|
using skydiveLogs_api.DomainService.Repositories;
|
||||||
using skydiveLogs_api.Infrastructure.Interfaces;
|
using skydiveLogs_api.Infrastructure.Interfaces;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace skydiveLogs_api.Infrastructure
|
namespace skydiveLogs_api.Infrastructure
|
||||||
{
|
{
|
||||||
@@ -20,6 +21,17 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a new user image to the database.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="newImage">The user image instance to insert into the database.</param>
|
||||||
|
/// <returns>The number of rows affected. Returns 0 if the insert operation failed.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// Attempts to insert the new user image into the database using LiteDB.
|
||||||
|
/// The user image 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.
|
||||||
|
/// </remarks>
|
||||||
public int Add(UserImage newImage)
|
public int Add(UserImage newImage)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
@@ -37,11 +49,30 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves all user images from the database.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>An enumerable collection containing all user image instances stored in the database.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method is not currently implemented and throws a <see cref="NotImplementedException"/> when called.
|
||||||
|
/// Implement this method to retrieve all user image records from the database.
|
||||||
|
/// </remarks>
|
||||||
|
/// <exception cref="NotImplementedException">Thrown when the method is called.</exception>
|
||||||
public IEnumerable<UserImage> GetAll()
|
public IEnumerable<UserImage> GetAll()
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves all user images for a specific user.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="user">The user whose image records to retrieve.</param>
|
||||||
|
/// <returns>An enumerable collection containing all user image instances belonging to the specified user.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// Queries the user image collection and retrieves all records where the user ID matches the provided user.
|
||||||
|
/// Each returned image record includes navigation properties to the associated user entity.
|
||||||
|
/// Returns an empty collection if the user has no profile images.
|
||||||
|
/// </remarks>
|
||||||
public IEnumerable<UserImage> GetAll(User user)
|
public IEnumerable<UserImage> GetAll(User user)
|
||||||
{
|
{
|
||||||
return _col.Include(x => x.User)
|
return _col.Include(x => x.User)
|
||||||
@@ -50,16 +81,46 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves a user image by its unique identifier.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The unique identifier of the user image to retrieve.</param>
|
||||||
|
/// <returns>The user image instance if found, otherwise null.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// Searches the user image collection for a record with the specified ID.
|
||||||
|
/// Returns null if no user image with the matching ID is found in the database.
|
||||||
|
/// </remarks>
|
||||||
public UserImage GetById(int id)
|
public UserImage GetById(int id)
|
||||||
{
|
{
|
||||||
return _col.FindById(new BsonValue(id));
|
return _col.FindById(new BsonValue(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the total count of user images for a specific user.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="user">The user whose image records to count.</param>
|
||||||
|
/// <returns>The total number of user image records for the specified user.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method is not currently implemented and throws a <see cref="NotImplementedException"/> when called.
|
||||||
|
/// Implement this method to retrieve the count of user image records per user.
|
||||||
|
/// </remarks>
|
||||||
|
/// <exception cref="NotImplementedException">Thrown when the method is called.</exception>
|
||||||
public int GetCount()
|
public int GetCount()
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates an existing user image record in the database.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="image">The user image instance containing the updated data.</param>
|
||||||
|
/// <returns><see langword="true"/> if the update was successful; otherwise, <see langword="false"/>.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// Updates the user image record in the database with the provided image instance.
|
||||||
|
/// The user image must have a valid ID to be updated.
|
||||||
|
/// The method returns the result of the underlying LiteDB update operation.
|
||||||
|
/// If the user image does not exist, the update operation will return 0.
|
||||||
|
/// </remarks>
|
||||||
public bool Update(UserImage image)
|
public bool Update(UserImage image)
|
||||||
{
|
{
|
||||||
return _col.Update(image);
|
return _col.Update(image);
|
||||||
@@ -70,8 +131,9 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
#region Private Fields
|
#region Private Fields
|
||||||
|
|
||||||
private readonly ILiteCollection<UserImage> _col;
|
private readonly ILiteCollection<UserImage> _col;
|
||||||
|
|
||||||
private readonly IDataProvider _dataProvider;
|
private readonly IDataProvider _dataProvider;
|
||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using LiteDB;
|
using LiteDB;
|
||||||
using skydiveLogs_api.Domain;
|
using skydiveLogs_api.Domain;
|
||||||
using skydiveLogs_api.DomainService.Repositories;
|
using skydiveLogs_api.DomainService.Repositories;
|
||||||
using skydiveLogs_api.Infrastructure.Interfaces;
|
using skydiveLogs_api.Infrastructure.Interfaces;
|
||||||
@@ -11,6 +11,10 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
{
|
{
|
||||||
#region Public Constructors
|
#region Public Constructors
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="UserRepository"/> class
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dataProvider">The data provider to use for data access</param>
|
||||||
public UserRepository(IDataProvider dataProvider)
|
public UserRepository(IDataProvider dataProvider)
|
||||||
{
|
{
|
||||||
_dataProvider = dataProvider;
|
_dataProvider = dataProvider;
|
||||||
@@ -21,6 +25,11 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a new user to the database
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="newUser">The user instance to add</param>
|
||||||
|
/// <returns>The number of rows affected (0 if insert failed)</returns>
|
||||||
public int Add(User newUser)
|
public int Add(User newUser)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
@@ -38,26 +47,50 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves all users from the database
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of all user instances</returns>
|
||||||
public IEnumerable<User> GetAll()
|
public IEnumerable<User> GetAll()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves a user by its unique identifier
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The unique identifier of the user</param>
|
||||||
|
/// <returns>The user instance or null if not found</returns>
|
||||||
public User GetById(int id)
|
public User GetById(int id)
|
||||||
{
|
{
|
||||||
return _col.FindById(new BsonValue(id));
|
return _col.FindById(new BsonValue(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves a user by their login credentials
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="login">The user's login</param>
|
||||||
|
/// <param name="password">The user's password</param>
|
||||||
|
/// <returns>The user instance or null if not found</returns>
|
||||||
public User GetByLogin(string login, string password)
|
public User GetByLogin(string login, string password)
|
||||||
{
|
{
|
||||||
return _col.FindOne(u => u.Login == login && u.Password == password);
|
return _col.FindOne(u => u.Login == login && u.Password == password);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the total count of users in the database
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The total number of users</returns>
|
||||||
public int GetCount()
|
public int GetCount()
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
throw new System.NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates an existing user in the database
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="updated">The user instance to update</param>
|
||||||
|
/// <returns>True if the update was successful, false otherwise</returns>
|
||||||
public bool Update(User updated)
|
public bool Update(User updated)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
@@ -72,4 +105,4 @@ namespace skydiveLogs_api.Infrastructure
|
|||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
using AutoMapper;
|
using System.Collections.Generic;
|
||||||
|
using AutoMapper;
|
||||||
using Microsoft.AspNetCore.Cors;
|
using Microsoft.AspNetCore.Cors;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using skydiveLogs_api.DataContract;
|
using skydiveLogs_api.DataContract;
|
||||||
using skydiveLogs_api.Domain;
|
using skydiveLogs_api.Domain;
|
||||||
using skydiveLogs_api.DomainBusiness.Interfaces;
|
using skydiveLogs_api.DomainBusiness.Interfaces;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace skydiveLogs_api.Controllers
|
namespace skydiveLogs_api.Controllers
|
||||||
{
|
{
|
||||||
@@ -23,7 +23,10 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
// DELETE: api/ApiWithActions/5
|
/// <summary>
|
||||||
|
/// Deletes an aircraft by its ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The aircraft ID to delete.</param>
|
||||||
[HttpDelete("{id}")]
|
[HttpDelete("{id}")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
@@ -31,7 +34,10 @@ namespace skydiveLogs_api.Controllers
|
|||||||
_aircraftService.DeleteAircraftById(id);
|
_aircraftService.DeleteAircraftById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: api/Aircraft
|
/// <summary>
|
||||||
|
/// Retrieves a list of all aircraft.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of AircraftResp objects containing all aircraft data.</returns>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public IEnumerable<AircraftResp> Get()
|
public IEnumerable<AircraftResp> Get()
|
||||||
@@ -40,7 +46,11 @@ namespace skydiveLogs_api.Controllers
|
|||||||
return _mapper.Map<IEnumerable<AircraftResp>>(result);
|
return _mapper.Map<IEnumerable<AircraftResp>>(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: api/Aircraft/5
|
/// <summary>
|
||||||
|
/// Retrieves an aircraft by its ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The aircraft ID to retrieve.</param>
|
||||||
|
/// <returns>An AircraftResp object containing the aircraft details.</returns>
|
||||||
[HttpGet("{id}")]
|
[HttpGet("{id}")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public AircraftResp Get(int id)
|
public AircraftResp Get(int id)
|
||||||
@@ -49,6 +59,10 @@ namespace skydiveLogs_api.Controllers
|
|||||||
return _mapper.Map<AircraftResp>(result);
|
return _mapper.Map<AircraftResp>(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves a simplified list of all aircraft.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of AircraftSimpleResp objects containing simplified aircraft data.</returns>
|
||||||
[HttpGet("GetSimple")]
|
[HttpGet("GetSimple")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public IEnumerable<AircraftSimpleResp> GetSimple()
|
public IEnumerable<AircraftSimpleResp> GetSimple()
|
||||||
@@ -57,7 +71,10 @@ namespace skydiveLogs_api.Controllers
|
|||||||
return _mapper.Map<IEnumerable<AircraftSimpleResp>>(result);
|
return _mapper.Map<IEnumerable<AircraftSimpleResp>>(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: api/Aircraft
|
/// <summary>
|
||||||
|
/// Adds a new aircraft to the system.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">AircraftReq object containing the new aircraft data.</param>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public void Post([FromBody] AircraftReq value)
|
public void Post([FromBody] AircraftReq value)
|
||||||
@@ -65,7 +82,11 @@ namespace skydiveLogs_api.Controllers
|
|||||||
_aircraftService.AddNewAircraft(_mapper.Map<Aircraft>(value));
|
_aircraftService.AddNewAircraft(_mapper.Map<Aircraft>(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
// PUT: api/Aircraft/5
|
/// <summary>
|
||||||
|
/// Updates an existing aircraft.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The aircraft ID to update.</param>
|
||||||
|
/// <param name="value">AircraftReq object containing the updated aircraft data.</param>
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public void Put(int id, [FromBody] AircraftReq value)
|
public void Put(int id, [FromBody] AircraftReq value)
|
||||||
@@ -82,4 +103,4 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
using AutoMapper;
|
using System.Collections.Generic;
|
||||||
|
using AutoMapper;
|
||||||
using Microsoft.AspNetCore.Cors;
|
using Microsoft.AspNetCore.Cors;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using skydiveLogs_api.DataContract;
|
using skydiveLogs_api.DataContract;
|
||||||
using skydiveLogs_api.Domain;
|
using skydiveLogs_api.Domain;
|
||||||
using skydiveLogs_api.DomainBusiness.Interfaces;
|
using skydiveLogs_api.DomainBusiness.Interfaces;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace skydiveLogs_api.Controllers
|
namespace skydiveLogs_api.Controllers
|
||||||
{
|
{
|
||||||
@@ -23,7 +23,11 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
// PUT: api/DropZone/AddToFavorite/5
|
/// <summary>
|
||||||
|
/// Adds a drop zone to the user's favorites.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The drop zone ID to add to favorites.</param>
|
||||||
|
/// <returns>True if successful, false otherwise.</returns>
|
||||||
[HttpPut("AddToFavorite/{id}")]
|
[HttpPut("AddToFavorite/{id}")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public bool AddToFavorite(int id)
|
public bool AddToFavorite(int id)
|
||||||
@@ -31,7 +35,10 @@ namespace skydiveLogs_api.Controllers
|
|||||||
return _dropZoneService.AddToFavorite(id);
|
return _dropZoneService.AddToFavorite(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// DELETE: api/ApiWithActions
|
/// <summary>
|
||||||
|
/// Deletes a drop zone by its ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The drop zone ID to delete.</param>
|
||||||
[HttpDelete("{id}")]
|
[HttpDelete("{id}")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
@@ -39,7 +46,10 @@ namespace skydiveLogs_api.Controllers
|
|||||||
_dropZoneService.DeleteDzById(id);
|
_dropZoneService.DeleteDzById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: api/DropZone
|
/// <summary>
|
||||||
|
/// Retrieves a list of all drop zones.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of DropZoneResp objects containing all drop zones.</returns>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public IEnumerable<DropZoneResp> Get()
|
public IEnumerable<DropZoneResp> Get()
|
||||||
@@ -49,7 +59,11 @@ namespace skydiveLogs_api.Controllers
|
|||||||
return _mapper.Map<IEnumerable<DropZoneResp>>(result);
|
return _mapper.Map<IEnumerable<DropZoneResp>>(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: api/DropZone/5
|
/// <summary>
|
||||||
|
/// Retrieves a drop zone by its ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The drop zone ID to retrieve.</param>
|
||||||
|
/// <returns>A DropZoneResp object containing the drop zone details.</returns>
|
||||||
[HttpGet("{id}")]
|
[HttpGet("{id}")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public DropZoneResp Get(int id)
|
public DropZoneResp Get(int id)
|
||||||
@@ -59,6 +73,10 @@ namespace skydiveLogs_api.Controllers
|
|||||||
return _mapper.Map<DropZoneResp>(result);
|
return _mapper.Map<DropZoneResp>(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves a simplified list of all drop zones.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of DropZoneSimpleResp objects containing simplified drop zone data.</returns>
|
||||||
[HttpGet("GetSimple")]
|
[HttpGet("GetSimple")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public IEnumerable<DropZoneSimpleResp> GetSimple()
|
public IEnumerable<DropZoneSimpleResp> GetSimple()
|
||||||
@@ -68,7 +86,10 @@ namespace skydiveLogs_api.Controllers
|
|||||||
return _mapper.Map<IEnumerable<DropZoneSimpleResp>>(result);
|
return _mapper.Map<IEnumerable<DropZoneSimpleResp>>(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: api/DropZone
|
/// <summary>
|
||||||
|
/// Adds a new drop zone to the system.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">DropZoneReq object containing the new drop zone data.</param>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public void Post([FromBody] DropZoneReq value)
|
public void Post([FromBody] DropZoneReq value)
|
||||||
@@ -76,7 +97,12 @@ namespace skydiveLogs_api.Controllers
|
|||||||
_dropZoneService.AddNewDz(_mapper.Map<DropZone>(value));
|
_dropZoneService.AddNewDz(_mapper.Map<DropZone>(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
// PUT: api/DropZone/5
|
/// <summary>
|
||||||
|
/// Updates an existing drop zone.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The drop zone ID to update.</param>
|
||||||
|
/// <param name="value">DropZoneReq object containing the updated drop zone data.</param>
|
||||||
|
/// <returns>True if successful, false otherwise.</returns>
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public bool Put(int id, [FromBody] DropZoneReq value)
|
public bool Put(int id, [FromBody] DropZoneReq value)
|
||||||
@@ -84,7 +110,11 @@ namespace skydiveLogs_api.Controllers
|
|||||||
return _dropZoneService.UpdateDz(id, _mapper.Map<DropZone>(value));
|
return _dropZoneService.UpdateDz(id, _mapper.Map<DropZone>(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
// PUT: api/DropZone/RemoveToFavorite/15
|
/// <summary>
|
||||||
|
/// Removes a drop zone from the user's favorites.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The drop zone ID to remove from favorites.</param>
|
||||||
|
/// <returns>True if successful, false otherwise.</returns>
|
||||||
[HttpPut("RemoveToFavorite/{id}")]
|
[HttpPut("RemoveToFavorite/{id}")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public bool RemoveToFavorite(int id)
|
public bool RemoveToFavorite(int id)
|
||||||
@@ -101,4 +131,4 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
using AutoMapper;
|
using System.Collections.Generic;
|
||||||
|
using AutoMapper;
|
||||||
using Microsoft.AspNetCore.Cors;
|
using Microsoft.AspNetCore.Cors;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using skydiveLogs_api.DataContract;
|
using skydiveLogs_api.DataContract;
|
||||||
using skydiveLogs_api.Domain;
|
using skydiveLogs_api.Domain;
|
||||||
using skydiveLogs_api.DomainBusiness.Interfaces;
|
using skydiveLogs_api.DomainBusiness.Interfaces;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace skydiveLogs_api.Controllers
|
namespace skydiveLogs_api.Controllers
|
||||||
{
|
{
|
||||||
@@ -23,7 +23,10 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
// DELETE: api/ApiWithActions/5
|
/// <summary>
|
||||||
|
/// Deletes a gear item by its ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The gear ID to delete.</param>
|
||||||
[HttpDelete("{id}")]
|
[HttpDelete("{id}")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
@@ -31,17 +34,23 @@ namespace skydiveLogs_api.Controllers
|
|||||||
_gearService.DeleteGearById(id);
|
_gearService.DeleteGearById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: api/Gear
|
/// <summary>
|
||||||
|
/// Retrieves a list of all gear items.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of GearResp objects containing all gear data.</returns>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public IEnumerable<GearResp> Get()
|
public IEnumerable<GearResp> Get()
|
||||||
{
|
{
|
||||||
//var result = _gearService.GetAllGears(ConnectedUser);
|
|
||||||
var result = _gearService.GetAllGears();
|
var result = _gearService.GetAllGears();
|
||||||
return _mapper.Map<IEnumerable<GearResp>>(result);
|
return _mapper.Map<IEnumerable<GearResp>>(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: api/Gear/5
|
/// <summary>
|
||||||
|
/// Retrieves a gear item by its ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The gear ID to retrieve.</param>
|
||||||
|
/// <returns>A GearResp object containing the gear details.</returns>
|
||||||
[HttpGet("{id}")]
|
[HttpGet("{id}")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public GearResp Get(int id)
|
public GearResp Get(int id)
|
||||||
@@ -50,7 +59,10 @@ namespace skydiveLogs_api.Controllers
|
|||||||
return _mapper.Map<GearResp>(result);
|
return _mapper.Map<GearResp>(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: api/Gear
|
/// <summary>
|
||||||
|
/// Adds a new gear item to the system.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">GearReq object containing the new gear data.</param>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public void Post([FromBody] GearReq value)
|
public void Post([FromBody] GearReq value)
|
||||||
@@ -58,7 +70,11 @@ namespace skydiveLogs_api.Controllers
|
|||||||
_gearService.AddNewGear(_mapper.Map<Gear>(value));
|
_gearService.AddNewGear(_mapper.Map<Gear>(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
// PUT: api/Gear/5
|
/// <summary>
|
||||||
|
/// Updates an existing gear item.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The gear ID to update.</param>
|
||||||
|
/// <param name="value">GearReq object containing the updated gear data.</param>
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public void Put(int id, [FromBody] GearReq value)
|
public void Put(int id, [FromBody] GearReq value)
|
||||||
@@ -76,4 +92,4 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
using AutoMapper;
|
using System.Collections.Generic;
|
||||||
|
using AutoMapper;
|
||||||
using Microsoft.AspNetCore.Cors;
|
using Microsoft.AspNetCore.Cors;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using skydiveLogs_api.DataContract;
|
using skydiveLogs_api.DataContract;
|
||||||
using skydiveLogs_api.Domain;
|
using skydiveLogs_api.Domain;
|
||||||
using skydiveLogs_api.DomainBusiness.Interfaces;
|
using skydiveLogs_api.DomainBusiness.Interfaces;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace skydiveLogs_api.Controllers
|
namespace skydiveLogs_api.Controllers
|
||||||
{
|
{
|
||||||
@@ -23,7 +23,10 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
// DELETE: api/Image/5
|
/// <summary>
|
||||||
|
/// Deletes an image by its ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The image ID to delete.</param>
|
||||||
[HttpDelete("{id}")]
|
[HttpDelete("{id}")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
@@ -31,7 +34,10 @@ namespace skydiveLogs_api.Controllers
|
|||||||
_imageService.DeleteImageById(id);
|
_imageService.DeleteImageById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: api/Image
|
/// <summary>
|
||||||
|
/// Retrieves a list of all images.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of ImageResp objects containing all images.</returns>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public IEnumerable<ImageResp> Get()
|
public IEnumerable<ImageResp> Get()
|
||||||
@@ -40,7 +46,11 @@ namespace skydiveLogs_api.Controllers
|
|||||||
return _mapper.Map<IEnumerable<ImageResp>>(result);
|
return _mapper.Map<IEnumerable<ImageResp>>(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: api/Image/5
|
/// <summary>
|
||||||
|
/// Retrieves an image by its ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The image ID to retrieve.</param>
|
||||||
|
/// <returns>An ImageResp object containing the image details.</returns>
|
||||||
[HttpGet("{id}")]
|
[HttpGet("{id}")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public ImageResp Get(int id)
|
public ImageResp Get(int id)
|
||||||
@@ -49,7 +59,10 @@ namespace skydiveLogs_api.Controllers
|
|||||||
return _mapper.Map<ImageResp>(result);
|
return _mapper.Map<ImageResp>(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: api/Image
|
/// <summary>
|
||||||
|
/// Adds a new image to the system.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">ImageReq object containing the new image data.</param>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public void Post([FromBody] ImageReq value)
|
public void Post([FromBody] ImageReq value)
|
||||||
@@ -57,7 +70,11 @@ namespace skydiveLogs_api.Controllers
|
|||||||
_imageService.AddNewImage(_mapper.Map<UserImage>(value));
|
_imageService.AddNewImage(_mapper.Map<UserImage>(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
// PUT: api/Image/5
|
/// <summary>
|
||||||
|
/// Updates an existing image.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The image ID to update.</param>
|
||||||
|
/// <param name="value">ImageReq object containing the updated image data.</param>
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public void Put(int id, [FromBody] ImageReq value)
|
public void Put(int id, [FromBody] ImageReq value)
|
||||||
@@ -74,4 +91,4 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,10 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
// DELETE: api/Jump/5
|
/// <summary>
|
||||||
|
/// Deletes a jump by its ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The jump ID to delete.</param>
|
||||||
[HttpDelete("{id}")]
|
[HttpDelete("{id}")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
@@ -32,7 +35,10 @@ namespace skydiveLogs_api.Controllers
|
|||||||
_jumpService.DeleteJumpById(id);
|
_jumpService.DeleteJumpById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: api/Jump
|
/// <summary>
|
||||||
|
/// Retrieves a list of all jumps.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A JumpListResp containing all jumps and their count.</returns>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public JumpListResp Get()
|
public JumpListResp Get()
|
||||||
@@ -47,7 +53,12 @@ namespace skydiveLogs_api.Controllers
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: api/Jump/5/10
|
/// <summary>
|
||||||
|
/// Retrieves a page of jumps with pagination.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="beginJumpIndex">The starting index for pagination.</param>
|
||||||
|
/// <param name="endJumpIndex">The ending index for pagination.</param>
|
||||||
|
/// <returns>A JumpListResp containing the requested page and total count.</returns>
|
||||||
[HttpGet("{beginJumpIndex}/{endJumpIndex}")]
|
[HttpGet("{beginJumpIndex}/{endJumpIndex}")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public JumpListResp Get(int beginJumpIndex, int endJumpIndex)
|
public JumpListResp Get(int beginJumpIndex, int endJumpIndex)
|
||||||
@@ -63,7 +74,11 @@ namespace skydiveLogs_api.Controllers
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: api/Jump/5
|
/// <summary>
|
||||||
|
/// Retrieves a jump by its ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The jump ID to retrieve.</param>
|
||||||
|
/// <returns>A JumpResp containing the jump details.</returns>
|
||||||
[HttpGet("{id}")]
|
[HttpGet("{id}")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public JumpResp Get(int id)
|
public JumpResp Get(int id)
|
||||||
@@ -72,7 +87,10 @@ namespace skydiveLogs_api.Controllers
|
|||||||
return _mapper.Map<JumpResp>(result);
|
return _mapper.Map<JumpResp>(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: api/Jump
|
/// <summary>
|
||||||
|
/// Adds a new jump to the system.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">JumpReq object containing the new jump data.</param>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public void Post([FromBody] JumpReq value)
|
public void Post([FromBody] JumpReq value)
|
||||||
@@ -84,7 +102,11 @@ namespace skydiveLogs_api.Controllers
|
|||||||
_mapper.Map<Jump>(value));
|
_mapper.Map<Jump>(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
// PUT: api/Jump/5
|
/// <summary>
|
||||||
|
/// Updates an existing jump.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The jump ID to update.</param>
|
||||||
|
/// <param name="value">JumpReq object containing the new jump data.</param>
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public void Put(int id, [FromBody] JumpReq value)
|
public void Put(int id, [FromBody] JumpReq value)
|
||||||
@@ -101,4 +123,4 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
using AutoMapper;
|
using System.Collections.Generic;
|
||||||
|
using AutoMapper;
|
||||||
using Microsoft.AspNetCore.Cors;
|
using Microsoft.AspNetCore.Cors;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using skydiveLogs_api.DataContract;
|
using skydiveLogs_api.DataContract;
|
||||||
using skydiveLogs_api.Domain;
|
using skydiveLogs_api.Domain;
|
||||||
using skydiveLogs_api.DomainBusiness.Interfaces;
|
using skydiveLogs_api.DomainBusiness.Interfaces;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace skydiveLogs_api.Controllers
|
namespace skydiveLogs_api.Controllers
|
||||||
{
|
{
|
||||||
@@ -23,7 +23,10 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
// DELETE: api/ApiWithActions/5
|
/// <summary>
|
||||||
|
/// Deletes a jump type by its ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The jump type ID to delete.</param>
|
||||||
[HttpDelete("{id}")]
|
[HttpDelete("{id}")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
@@ -31,7 +34,10 @@ namespace skydiveLogs_api.Controllers
|
|||||||
_jumpTypeService.DeleteJumpTypeById(id);
|
_jumpTypeService.DeleteJumpTypeById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: api/JumpType
|
/// <summary>
|
||||||
|
/// Retrieves a list of all jump types.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of JumpTypeResp objects containing all jump types.</returns>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public IEnumerable<JumpTypeResp> Get()
|
public IEnumerable<JumpTypeResp> Get()
|
||||||
@@ -39,8 +45,11 @@ namespace skydiveLogs_api.Controllers
|
|||||||
var result = _jumpTypeService.GetAllJumpTypes();
|
var result = _jumpTypeService.GetAllJumpTypes();
|
||||||
return _mapper.Map<IEnumerable<JumpTypeResp>>(result);
|
return _mapper.Map<IEnumerable<JumpTypeResp>>(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: api/JumpType/tunnel
|
/// <summary>
|
||||||
|
/// Retrieves jump types used for tunnel operations.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of JumpTypeResp objects containing tunnel jump types.</returns>
|
||||||
[HttpGet("tunnel")]
|
[HttpGet("tunnel")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public IEnumerable<JumpTypeResp> GetForTunnel()
|
public IEnumerable<JumpTypeResp> GetForTunnel()
|
||||||
@@ -49,7 +58,11 @@ namespace skydiveLogs_api.Controllers
|
|||||||
return _mapper.Map<IEnumerable<JumpTypeResp>>(result);
|
return _mapper.Map<IEnumerable<JumpTypeResp>>(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: api/JumpType/5
|
/// <summary>
|
||||||
|
/// Retrieves a jump type by its ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The jump type ID to retrieve.</param>
|
||||||
|
/// <returns>A JumpTypeResp object containing the jump type details.</returns>
|
||||||
[HttpGet("{id}")]
|
[HttpGet("{id}")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public JumpTypeResp Get(int id)
|
public JumpTypeResp Get(int id)
|
||||||
@@ -58,7 +71,10 @@ namespace skydiveLogs_api.Controllers
|
|||||||
return _mapper.Map<JumpTypeResp>(result);
|
return _mapper.Map<JumpTypeResp>(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: api/JumpType
|
/// <summary>
|
||||||
|
/// Adds a new jump type to the system.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">JumpTypeReq object containing the new jump type data.</param>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public void Post([FromBody] JumpTypeReq value)
|
public void Post([FromBody] JumpTypeReq value)
|
||||||
@@ -66,7 +82,11 @@ namespace skydiveLogs_api.Controllers
|
|||||||
_jumpTypeService.AddNewJumpType(_mapper.Map<JumpType>(value));
|
_jumpTypeService.AddNewJumpType(_mapper.Map<JumpType>(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
// PUT: api/JumpType/5
|
/// <summary>
|
||||||
|
/// Updates an existing jump type.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The jump type ID to update.</param>
|
||||||
|
/// <param name="value">JumpTypeReq object containing the updated jump type data.</param>
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public void Put(int id, [FromBody] JumpTypeReq value)
|
public void Put(int id, [FromBody] JumpTypeReq value)
|
||||||
@@ -83,4 +103,4 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,10 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves statistics grouped by aircraft.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of StatisticResp objects containing aircraft statistics.</returns>
|
||||||
[HttpGet("ByAircraft")]
|
[HttpGet("ByAircraft")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public IEnumerable<StatisticResp> ByAircraft()
|
public IEnumerable<StatisticResp> ByAircraft()
|
||||||
@@ -31,6 +35,10 @@ namespace skydiveLogs_api.Controllers
|
|||||||
return _mapper.Map<IEnumerable<StatisticResp>>(result);
|
return _mapper.Map<IEnumerable<StatisticResp>>(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves statistics grouped by drop zone.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of StatisticResp objects containing drop zone statistics.</returns>
|
||||||
[HttpGet("ByDz")]
|
[HttpGet("ByDz")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public IEnumerable<StatisticResp> ByDz()
|
public IEnumerable<StatisticResp> ByDz()
|
||||||
@@ -40,6 +48,10 @@ namespace skydiveLogs_api.Controllers
|
|||||||
return _mapper.Map<IEnumerable<StatisticResp>>(result);
|
return _mapper.Map<IEnumerable<StatisticResp>>(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves statistics grouped by gear.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of StatisticResp objects containing gear statistics.</returns>
|
||||||
[HttpGet("ByGear")]
|
[HttpGet("ByGear")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public IEnumerable<StatisticResp> ByGear()
|
public IEnumerable<StatisticResp> ByGear()
|
||||||
@@ -49,6 +61,10 @@ namespace skydiveLogs_api.Controllers
|
|||||||
return _mapper.Map<IEnumerable<StatisticResp>>(result);
|
return _mapper.Map<IEnumerable<StatisticResp>>(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves statistics grouped by jump type.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of StatisticResp objects containing jump type statistics.</returns>
|
||||||
[HttpGet("ByJumpType")]
|
[HttpGet("ByJumpType")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public IEnumerable<StatisticResp> ByJumpType()
|
public IEnumerable<StatisticResp> ByJumpType()
|
||||||
@@ -58,6 +74,10 @@ namespace skydiveLogs_api.Controllers
|
|||||||
return _mapper.Map<IEnumerable<StatisticResp>>(result);
|
return _mapper.Map<IEnumerable<StatisticResp>>(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves statistics grouped by year.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of StatisticResp objects containing year statistics.</returns>
|
||||||
[HttpGet("ByYear")]
|
[HttpGet("ByYear")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public IEnumerable<StatisticResp> ByYear()
|
public IEnumerable<StatisticResp> ByYear()
|
||||||
@@ -67,6 +87,10 @@ namespace skydiveLogs_api.Controllers
|
|||||||
return _mapper.Map<IEnumerable<StatisticResp>>(result);
|
return _mapper.Map<IEnumerable<StatisticResp>>(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves statistics for the last month grouped by drop zone and jump type.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A StatisticForLastMonthResp object containing last month statistics.</returns>
|
||||||
[HttpGet("ForLastMonth")]
|
[HttpGet("ForLastMonth")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public StatisticForLastMonthResp ForLastMonth()
|
public StatisticForLastMonthResp ForLastMonth()
|
||||||
@@ -81,6 +105,10 @@ namespace skydiveLogs_api.Controllers
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves statistics for the last year grouped by drop zone and jump type.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A StatisticForLastYearResp object containing last year statistics.</returns>
|
||||||
[HttpGet("ForLastYear")]
|
[HttpGet("ForLastYear")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public StatisticForLastYearResp ForLastYear()
|
public StatisticForLastYearResp ForLastYear()
|
||||||
@@ -95,6 +123,10 @@ namespace skydiveLogs_api.Controllers
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves statistics by year grouped with jump type for chart visualization.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of StatisticForChartResp objects containing yearly jump type statistics.</returns>
|
||||||
[HttpGet("ByYearByJumpType")]
|
[HttpGet("ByYearByJumpType")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public IEnumerable<StatisticForChartResp> ByYearByJumpType()
|
public IEnumerable<StatisticForChartResp> ByYearByJumpType()
|
||||||
@@ -104,6 +136,9 @@ namespace skydiveLogs_api.Controllers
|
|||||||
return _mapper.Map<IEnumerable<StatisticForChartResp>>(result);
|
return _mapper.Map<IEnumerable<StatisticForChartResp>>(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resets all statistics to their initial state.
|
||||||
|
/// </summary>
|
||||||
[HttpGet("Reset")]
|
[HttpGet("Reset")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public void Reset()
|
public void Reset()
|
||||||
@@ -111,6 +146,10 @@ namespace skydiveLogs_api.Controllers
|
|||||||
_statsService.Reset();
|
_statsService.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves a simple summary of all statistics.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A SimpleSummaryResp object containing the simple summary statistics.</returns>
|
||||||
[HttpGet("Simple")]
|
[HttpGet("Simple")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public SimpleSummaryResp Simple()
|
public SimpleSummaryResp Simple()
|
||||||
@@ -129,4 +168,4 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
#endregion Private properties
|
#endregion Private properties
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
using AutoMapper;
|
using System.Collections.Generic;
|
||||||
|
using AutoMapper;
|
||||||
using Microsoft.AspNetCore.Cors;
|
using Microsoft.AspNetCore.Cors;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using skydiveLogs_api.DataContract;
|
using skydiveLogs_api.DataContract;
|
||||||
using skydiveLogs_api.DomainBusiness.Interfaces;
|
using skydiveLogs_api.DomainBusiness.Interfaces;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace skydiveLogs_api.Controllers
|
namespace skydiveLogs_api.Controllers
|
||||||
{
|
{
|
||||||
@@ -22,7 +22,10 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
// GET: api/Tunnel
|
/// <summary>
|
||||||
|
/// Retrieves a list of all tunnels.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of TunnelResp objects containing all tunnels.</returns>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public IEnumerable<TunnelResp> Get()
|
public IEnumerable<TunnelResp> Get()
|
||||||
@@ -31,7 +34,11 @@ namespace skydiveLogs_api.Controllers
|
|||||||
return _mapper.Map<IEnumerable<TunnelResp>>(result);
|
return _mapper.Map<IEnumerable<TunnelResp>>(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: api/Tunnel/5
|
/// <summary>
|
||||||
|
/// Retrieves a tunnel by its ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The tunnel ID to retrieve.</param>
|
||||||
|
/// <returns>A TunnelResp object containing the tunnel details.</returns>
|
||||||
[HttpGet("{id}")]
|
[HttpGet("{id}")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public TunnelResp Get(int id)
|
public TunnelResp Get(int id)
|
||||||
@@ -49,4 +56,4 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
using AutoMapper;
|
using System.Collections.Generic;
|
||||||
|
using AutoMapper;
|
||||||
using Microsoft.AspNetCore.Cors;
|
using Microsoft.AspNetCore.Cors;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using skydiveLogs_api.DataContract;
|
using skydiveLogs_api.DataContract;
|
||||||
using skydiveLogs_api.Domain;
|
using skydiveLogs_api.Domain;
|
||||||
using skydiveLogs_api.DomainBusiness.Interfaces;
|
using skydiveLogs_api.DomainBusiness.Interfaces;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace skydiveLogs_api.Controllers
|
namespace skydiveLogs_api.Controllers
|
||||||
{
|
{
|
||||||
@@ -23,7 +23,10 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
// GET: api/TunnelFlight
|
/// <summary>
|
||||||
|
/// Retrieves a list of all tunnel flights.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A collection of TunnelFlightResp objects containing all tunnel flights.</returns>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public IEnumerable<TunnelFlightResp> Get()
|
public IEnumerable<TunnelFlightResp> Get()
|
||||||
@@ -32,7 +35,11 @@ namespace skydiveLogs_api.Controllers
|
|||||||
return _mapper.Map<IEnumerable<TunnelFlightResp>>(result);
|
return _mapper.Map<IEnumerable<TunnelFlightResp>>(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: api/TunnelFlight/5
|
/// <summary>
|
||||||
|
/// Retrieves a tunnel flight by its ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The tunnel flight ID to retrieve.</param>
|
||||||
|
/// <returns>A TunnelFlightResp object containing the tunnel flight details.</returns>
|
||||||
[HttpGet("{id}")]
|
[HttpGet("{id}")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public TunnelFlightResp Get(int id)
|
public TunnelFlightResp Get(int id)
|
||||||
@@ -41,7 +48,12 @@ namespace skydiveLogs_api.Controllers
|
|||||||
return _mapper.Map<TunnelFlightResp>(result);
|
return _mapper.Map<TunnelFlightResp>(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: api/TunnelFlight/20230101/20230701
|
/// <summary>
|
||||||
|
/// Retrieves tunnel flights filtered by date range.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="beginDate">The start date for filtering.</param>
|
||||||
|
/// <param name="endDate">The end date for filtering.</param>
|
||||||
|
/// <returns>A collection of TunnelFlightResp objects filtered by the specified date range.</returns>
|
||||||
[HttpGet("{beginDate}/{endDate}")]
|
[HttpGet("{beginDate}/{endDate}")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public IEnumerable<TunnelFlightResp> Get(string beginDate, string endDate)
|
public IEnumerable<TunnelFlightResp> Get(string beginDate, string endDate)
|
||||||
@@ -50,7 +62,12 @@ namespace skydiveLogs_api.Controllers
|
|||||||
return _mapper.Map<IEnumerable<TunnelFlightResp>>(result);
|
return _mapper.Map<IEnumerable<TunnelFlightResp>>(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: api/TunnelFlight/month/20230101/20230701
|
/// <summary>
|
||||||
|
/// Retrieves tunnel flights grouped by month within a date range.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="beginDate">The start date for grouping.</param>
|
||||||
|
/// <param name="endDate">The end date for grouping.</param>
|
||||||
|
/// <returns>A collection of StatisticForChartResp objects grouped by month.</returns>
|
||||||
[HttpGet("month/{beginDate}/{endDate}")]
|
[HttpGet("month/{beginDate}/{endDate}")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public IEnumerable<StatisticForChartResp> GetGroupByMonth(string beginDate, string endDate)
|
public IEnumerable<StatisticForChartResp> GetGroupByMonth(string beginDate, string endDate)
|
||||||
@@ -59,7 +76,10 @@ namespace skydiveLogs_api.Controllers
|
|||||||
return _mapper.Map<IEnumerable<StatisticForChartResp>>(result);
|
return _mapper.Map<IEnumerable<StatisticForChartResp>>(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: api/Tunnel
|
/// <summary>
|
||||||
|
/// Adds a new tunnel flight to the system.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">TunnelFlightReq object containing the new tunnel flight data.</param>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public void Post([FromBody] TunnelFlightReq value)
|
public void Post([FromBody] TunnelFlightReq value)
|
||||||
@@ -69,7 +89,11 @@ namespace skydiveLogs_api.Controllers
|
|||||||
_mapper.Map<TunnelFlight>(value));
|
_mapper.Map<TunnelFlight>(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
// PUT: api/TunnelFlight/5
|
/// <summary>
|
||||||
|
/// Updates an existing tunnel flight.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The tunnel flight ID to update.</param>
|
||||||
|
/// <param name="value">TunnelFlightReq object containing the updated tunnel flight data.</param>
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public void Put(int id, [FromBody] TunnelFlightReq value)
|
public void Put(int id, [FromBody] TunnelFlightReq value)
|
||||||
@@ -77,7 +101,10 @@ namespace skydiveLogs_api.Controllers
|
|||||||
_tunnelFlightService.UpdateTunnelFlight(id, _mapper.Map<TunnelFlight>(value));
|
_tunnelFlightService.UpdateTunnelFlight(id, _mapper.Map<TunnelFlight>(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
// DELETE: api/TunnelFlight/5
|
/// <summary>
|
||||||
|
/// Deletes a tunnel flight by its ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The tunnel flight ID to delete.</param>
|
||||||
[HttpDelete("{id}")]
|
[HttpDelete("{id}")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
@@ -94,4 +121,4 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
using AutoMapper;
|
using System;
|
||||||
|
using System.IdentityModel.Tokens.Jwt;
|
||||||
|
using System.Security.Claims;
|
||||||
|
using System.Text;
|
||||||
|
using AutoMapper;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Cors;
|
using Microsoft.AspNetCore.Cors;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
@@ -8,10 +12,6 @@ using skydiveLogs_api.DataContract;
|
|||||||
using skydiveLogs_api.Domain;
|
using skydiveLogs_api.Domain;
|
||||||
using skydiveLogs_api.DomainBusiness.Interfaces;
|
using skydiveLogs_api.DomainBusiness.Interfaces;
|
||||||
using skydiveLogs_api.Settings;
|
using skydiveLogs_api.Settings;
|
||||||
using System;
|
|
||||||
using System.IdentityModel.Tokens.Jwt;
|
|
||||||
using System.Security.Claims;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace skydiveLogs_api.Controllers
|
namespace skydiveLogs_api.Controllers
|
||||||
{
|
{
|
||||||
@@ -34,7 +34,10 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
// GET: api/User/AlwayLogin
|
/// <summary>
|
||||||
|
/// Always login endpoint for testing authentication status.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>An Ok result indicating successful authentication.</returns>
|
||||||
[HttpGet("AlwaysLogin")]
|
[HttpGet("AlwaysLogin")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
public IActionResult AlwaysLogin()
|
public IActionResult AlwaysLogin()
|
||||||
@@ -42,7 +45,11 @@ namespace skydiveLogs_api.Controllers
|
|||||||
return Ok();
|
return Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: api/User/Authenticate
|
/// <summary>
|
||||||
|
/// Authenticates a user with login and password.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">UserReq containing login and password.</param>
|
||||||
|
/// <returns>UserResp with token if successful, BadRequest if failed.</returns>
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[HttpPost("Authenticate")]
|
[HttpPost("Authenticate")]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
@@ -67,7 +74,11 @@ namespace skydiveLogs_api.Controllers
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST: api/User
|
/// <summary>
|
||||||
|
/// Creates a new user and returns JWT token.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userToAdd">UserReq object containing new user data.</param>
|
||||||
|
/// <returns>UserResp with token if successful, BadRequest on error.</returns>
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[EnableCors]
|
[EnableCors]
|
||||||
@@ -135,4 +146,4 @@ namespace skydiveLogs_api.Controllers
|
|||||||
|
|
||||||
#endregion Private Fields
|
#endregion Private Fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,5 +25,7 @@ namespace skydiveLogs_api.DataContract
|
|||||||
public DateTime JumpDate { get; set; }
|
public DateTime JumpDate { get; set; }
|
||||||
|
|
||||||
public bool IsSpecial { get; set; }
|
public bool IsSpecial { get; set; }
|
||||||
|
|
||||||
|
public string Equipment { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,18 +7,29 @@ namespace skydiveLogs_api.DataContract
|
|||||||
#region Public Properties
|
#region Public Properties
|
||||||
|
|
||||||
public int AircraftId { get; set; }
|
public int AircraftId { get; set; }
|
||||||
|
|
||||||
public int DeployAltitude { get; set; }
|
public int DeployAltitude { get; set; }
|
||||||
|
|
||||||
public int DropZoneId { get; set; }
|
public int DropZoneId { get; set; }
|
||||||
|
|
||||||
public int ExitAltitude { get; set; }
|
public int ExitAltitude { get; set; }
|
||||||
|
|
||||||
public int GearId { get; set; }
|
public int GearId { get; set; }
|
||||||
|
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
public bool IsSpecial { get; set; }
|
public bool IsSpecial { get; set; }
|
||||||
|
|
||||||
public DateTime JumpDate { get; set; }
|
public DateTime JumpDate { get; set; }
|
||||||
|
|
||||||
public int JumpTypeId { get; set; }
|
public int JumpTypeId { get; set; }
|
||||||
|
|
||||||
public string Notes { get; set; }
|
public string Notes { get; set; }
|
||||||
|
|
||||||
public bool WithCutaway { get; set; }
|
public bool WithCutaway { get; set; }
|
||||||
|
|
||||||
|
public string Equipment { get; set; }
|
||||||
|
|
||||||
#endregion Public Properties
|
#endregion Public Properties
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Generated
+9995
-9995
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,91 @@
|
|||||||
|
<form (ngSubmit)="updateGear()">
|
||||||
|
<p>
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>{{ "GearInfos_Name" | translate }}</mat-label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
matInput
|
||||||
|
name="name"
|
||||||
|
[(ngModel)]="gear.name"
|
||||||
|
name="name"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
</mat-form-field>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>{{ "GearInfos_Manufacturer" | translate }}</mat-label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
matInput
|
||||||
|
name="manufacturer"
|
||||||
|
[(ngModel)]="gear.manufacturer"
|
||||||
|
name="manufacturer"
|
||||||
|
/>
|
||||||
|
</mat-form-field>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>{{ "GearInfos_MinSize" | translate }}Min size</mat-label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
matInput
|
||||||
|
name="minSize"
|
||||||
|
[(ngModel)]="gear.minSize"
|
||||||
|
name="minSize"
|
||||||
|
/>
|
||||||
|
</mat-form-field>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>{{ "GearInfos_MaxSize" | translate }}</mat-label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
matInput
|
||||||
|
name="maxSize"
|
||||||
|
[(ngModel)]="gear.maxSize"
|
||||||
|
name="maxSize"
|
||||||
|
/>
|
||||||
|
</mat-form-field>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>{{ "GearInfos_AAD" | translate }}</mat-label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
matInput
|
||||||
|
name="aad"
|
||||||
|
[(ngModel)]="gear.aad"
|
||||||
|
name="aad"
|
||||||
|
/>
|
||||||
|
</mat-form-field>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>{{ "GearInfos_MainCanopy" | translate }}</mat-label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
matInput
|
||||||
|
name="mainCanopy"
|
||||||
|
[(ngModel)]="gear.mainCanopy"
|
||||||
|
name="mainCanopy"
|
||||||
|
/>
|
||||||
|
</mat-form-field>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>{{ "GearInfos_ReserveCanopy" | translate }}</mat-label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
matInput
|
||||||
|
name="reserveCanopy"
|
||||||
|
[(ngModel)]="gear.reserveCanopy"
|
||||||
|
name="reserveCanopy"
|
||||||
|
/>
|
||||||
|
</mat-form-field>
|
||||||
|
</p>
|
||||||
|
<br />
|
||||||
|
@if (editMode) {
|
||||||
|
<button mat-raised-button color="accent">Update</button>
|
||||||
|
}
|
||||||
|
</form>
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
import { Component, Inject, OnInit } from "@angular/core";
|
||||||
|
|
||||||
|
import { MAT_DIALOG_DATA } from "@angular/material/dialog";
|
||||||
|
import { TranslateModule } from "@ngx-translate/core";
|
||||||
|
import { MatCheckboxModule } from "@angular/material/checkbox";
|
||||||
|
import { MatFormFieldModule } from "@angular/material/form-field";
|
||||||
|
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
|
||||||
|
import { MatInputModule } from "@angular/material/input";
|
||||||
|
import { MatButtonModule } from "@angular/material/button";
|
||||||
|
|
||||||
|
import { AddAction } from "../../models/add-action.enum";
|
||||||
|
import { GearResp } from "../../models/gear";
|
||||||
|
|
||||||
|
import { GearService } from "../../services/gear.service";
|
||||||
|
import { ServiceComm } from "../../services/service-comm.service";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: "app-gear-infos",
|
||||||
|
templateUrl: "./gear-infos.component.html",
|
||||||
|
styleUrls: ["./gear-infos.component.css"],
|
||||||
|
imports: [
|
||||||
|
TranslateModule,
|
||||||
|
FormsModule,
|
||||||
|
MatCheckboxModule,
|
||||||
|
MatFormFieldModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
MatInputModule,
|
||||||
|
MatButtonModule,
|
||||||
|
],
|
||||||
|
})
|
||||||
|
export class GearInfosComponent implements OnInit {
|
||||||
|
public editMode: boolean;
|
||||||
|
public gear: GearResp;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||||
|
private serviceGear: GearService,
|
||||||
|
private serviceComm: ServiceComm,
|
||||||
|
) {
|
||||||
|
this.gear = new GearResp(data.gear);
|
||||||
|
this.editMode = data.editMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {}
|
||||||
|
|
||||||
|
public updateGear() {
|
||||||
|
this.serviceGear
|
||||||
|
.updateGear(
|
||||||
|
this.gear.id,
|
||||||
|
this.gear.name,
|
||||||
|
this.gear.manufacturer,
|
||||||
|
this.gear.minSize,
|
||||||
|
this.gear.maxSize,
|
||||||
|
this.gear.aad,
|
||||||
|
this.gear.mainCanopy,
|
||||||
|
this.gear.reserveCanopy,
|
||||||
|
)
|
||||||
|
.subscribe(() => {
|
||||||
|
this.serviceComm.refreshData(AddAction.Gear);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
[(ngModel)]="jump.isSpecial"
|
[(ngModel)]="jump.isSpecial"
|
||||||
name="isSpecial"
|
name="isSpecial"
|
||||||
labelPosition="before"
|
labelPosition="before"
|
||||||
|
[disabled]="!editMode"
|
||||||
>Special jump</mat-checkbox
|
>Special jump</mat-checkbox
|
||||||
>
|
>
|
||||||
</p>
|
</p>
|
||||||
@@ -15,6 +16,7 @@
|
|||||||
[(ngModel)]="jump.withCutaway"
|
[(ngModel)]="jump.withCutaway"
|
||||||
name="withCutaway"
|
name="withCutaway"
|
||||||
labelPosition="before"
|
labelPosition="before"
|
||||||
|
[disabled]="!editMode"
|
||||||
>Cutaway</mat-checkbox
|
>Cutaway</mat-checkbox
|
||||||
>
|
>
|
||||||
</p>
|
</p>
|
||||||
@@ -26,11 +28,22 @@
|
|||||||
[(ngModel)]="jump.notes"
|
[(ngModel)]="jump.notes"
|
||||||
name="comments"
|
name="comments"
|
||||||
type="text"
|
type="text"
|
||||||
|
[disabled]="!editMode"
|
||||||
></textarea>
|
></textarea>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
<p>
|
||||||
<br />
|
<mat-form-field>
|
||||||
@if (editMode) {
|
<mat-label>{{ "NewJump_Equipment" | translate }}</mat-label>
|
||||||
<button mat-raised-button color="accent">Update</button>
|
<mat-select [(value)]="jump.equipment" [disabled]="!editMode">
|
||||||
}
|
@for (equipment of listOfEquipment; track equipment) {
|
||||||
|
<mat-option [value]="equipment.value">{{
|
||||||
|
equipment.viewValue
|
||||||
|
}}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
@if (editMode) {
|
||||||
|
<button mat-raised-button color="accent">Update</button>
|
||||||
|
}
|
||||||
|
</p>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { MatFormFieldModule } from "@angular/material/form-field";
|
|||||||
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
|
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
|
||||||
import { MatInputModule } from "@angular/material/input";
|
import { MatInputModule } from "@angular/material/input";
|
||||||
import { MatButtonModule } from "@angular/material/button";
|
import { MatButtonModule } from "@angular/material/button";
|
||||||
|
import { MatSelectModule } from "@angular/material/select";
|
||||||
|
|
||||||
import { AddAction } from "../../models/add-action.enum";
|
import { AddAction } from "../../models/add-action.enum";
|
||||||
import { JumpResp } from "../../models/jump";
|
import { JumpResp } from "../../models/jump";
|
||||||
@@ -14,6 +15,11 @@ import { JumpResp } from "../../models/jump";
|
|||||||
import { JumpService } from "../../services/jump.service";
|
import { JumpService } from "../../services/jump.service";
|
||||||
import { ServiceComm } from "../../services/service-comm.service";
|
import { ServiceComm } from "../../services/service-comm.service";
|
||||||
|
|
||||||
|
interface Equipment {
|
||||||
|
value: string;
|
||||||
|
viewValue: string;
|
||||||
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-jump-infos",
|
selector: "app-jump-infos",
|
||||||
templateUrl: "./jump-infos.component.html",
|
templateUrl: "./jump-infos.component.html",
|
||||||
@@ -26,11 +32,21 @@ import { ServiceComm } from "../../services/service-comm.service";
|
|||||||
ReactiveFormsModule,
|
ReactiveFormsModule,
|
||||||
MatInputModule,
|
MatInputModule,
|
||||||
MatButtonModule,
|
MatButtonModule,
|
||||||
|
MatSelectModule,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class JumpInfosComponent implements OnInit {
|
export class JumpInfosComponent implements OnInit {
|
||||||
public editMode: boolean;
|
public editMode: boolean;
|
||||||
public jump: JumpResp;
|
public jump: JumpResp;
|
||||||
|
public selectedEquipment: string;
|
||||||
|
public listOfEquipment: Array<Equipment> = [
|
||||||
|
{ value: "", viewValue: "<None>" },
|
||||||
|
{ value: "Freak 6", viewValue: "Freak 6" },
|
||||||
|
{ value: "ATC 4", viewValue: "ATC 4" },
|
||||||
|
{ value: "ATC 2", viewValue: "ATC 2" },
|
||||||
|
{ value: "Havok", viewValue: "Havok" },
|
||||||
|
{ value: "Hawk", viewValue: "Hawk" },
|
||||||
|
];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(MAT_DIALOG_DATA) public data: any,
|
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||||
@@ -38,6 +54,7 @@ export class JumpInfosComponent implements OnInit {
|
|||||||
private serviceComm: ServiceComm,
|
private serviceComm: ServiceComm,
|
||||||
) {
|
) {
|
||||||
this.jump = new JumpResp(data.jump);
|
this.jump = new JumpResp(data.jump);
|
||||||
|
this.selectedEquipment = this.jump.equipment;
|
||||||
this.editMode = data.editMode;
|
this.editMode = data.editMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,6 +67,7 @@ export class JumpInfosComponent implements OnInit {
|
|||||||
this.jump.isSpecial,
|
this.jump.isSpecial,
|
||||||
this.jump.withCutaway,
|
this.jump.withCutaway,
|
||||||
this.jump.notes,
|
this.jump.notes,
|
||||||
|
this.jump.equipment,
|
||||||
)
|
)
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
this.serviceComm.refreshData(AddAction.Jump);
|
this.serviceComm.refreshData(AddAction.Jump);
|
||||||
|
|||||||
@@ -71,6 +71,26 @@
|
|||||||
{{ element.reserveCanopy }}
|
{{ element.reserveCanopy }}
|
||||||
</td>
|
</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="actions">
|
||||||
|
<th
|
||||||
|
mat-header-cell
|
||||||
|
*matHeaderCellDef
|
||||||
|
style="min-width: 80px; text-wrap: nowrap"
|
||||||
|
></th>
|
||||||
|
<td
|
||||||
|
mat-cell
|
||||||
|
*matCellDef="let element"
|
||||||
|
style="text-align: left; text-wrap: nowrap"
|
||||||
|
>
|
||||||
|
<mat-icon
|
||||||
|
aria-hidden="false"
|
||||||
|
aria-label="Update this gear"
|
||||||
|
style="cursor: pointer; margin-left: 10px"
|
||||||
|
(click)="openDialog(element, true)"
|
||||||
|
svgIcon="edit"
|
||||||
|
></mat-icon>
|
||||||
|
</td>
|
||||||
|
</ng-container>
|
||||||
<tr
|
<tr
|
||||||
mat-header-row
|
mat-header-row
|
||||||
*matHeaderRowDef="displayedColumns; sticky: true"
|
*matHeaderRowDef="displayedColumns; sticky: true"
|
||||||
|
|||||||
@@ -6,12 +6,14 @@ import { TranslateModule, TranslateService } from "@ngx-translate/core";
|
|||||||
|
|
||||||
import { MatProgressSpinnerModule } from "@angular/material/progress-spinner";
|
import { MatProgressSpinnerModule } from "@angular/material/progress-spinner";
|
||||||
import { MatButtonModule } from "@angular/material/button";
|
import { MatButtonModule } from "@angular/material/button";
|
||||||
|
import { MatIconModule } from "@angular/material/icon";
|
||||||
|
|
||||||
import { GearService } from "../../services/gear.service";
|
import { GearService } from "../../services/gear.service";
|
||||||
import { ServiceComm } from "../../services/service-comm.service";
|
import { ServiceComm } from "../../services/service-comm.service";
|
||||||
import { GearResp } from "../../models/gear";
|
import { GearResp } from "../../models/gear";
|
||||||
import { AddAction } from "../../models/add-action.enum";
|
import { AddAction } from "../../models/add-action.enum";
|
||||||
import { NewGearComponent } from "../new-gear/new-gear.component";
|
import { NewGearComponent } from "../new-gear/new-gear.component";
|
||||||
|
import { GearInfosComponent } from "../gear-infos/gear-infos.component";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-list-of-gears",
|
selector: "app-list-of-gears",
|
||||||
@@ -23,6 +25,7 @@ import { NewGearComponent } from "../new-gear/new-gear.component";
|
|||||||
MatProgressSpinnerModule,
|
MatProgressSpinnerModule,
|
||||||
MatTableModule,
|
MatTableModule,
|
||||||
MatButtonModule,
|
MatButtonModule,
|
||||||
|
MatIconModule,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class ListOfGearsComponent implements OnInit {
|
export class ListOfGearsComponent implements OnInit {
|
||||||
@@ -33,6 +36,7 @@ export class ListOfGearsComponent implements OnInit {
|
|||||||
"aad",
|
"aad",
|
||||||
"mainCanopy",
|
"mainCanopy",
|
||||||
"reserveCanopy",
|
"reserveCanopy",
|
||||||
|
"actions",
|
||||||
];
|
];
|
||||||
public dataSourceTable: MatTableDataSource<GearResp>;
|
public dataSourceTable: MatTableDataSource<GearResp>;
|
||||||
public resultsLength = 0;
|
public resultsLength = 0;
|
||||||
@@ -80,6 +84,14 @@ export class ListOfGearsComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
openDialog(item: GearResp, editMode: boolean) {
|
||||||
|
this.dialog.open(GearInfosComponent, {
|
||||||
|
data: { gear: item, editMode: editMode },
|
||||||
|
maxHeight: "400px",
|
||||||
|
minWidth: "350px",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private updateTitle() {
|
private updateTitle() {
|
||||||
this.translateService.get("ListGears_Title").subscribe((data) => {
|
this.translateService.get("ListGears_Title").subscribe((data) => {
|
||||||
this.serviceComm.updatedComponentTitle(data);
|
this.serviceComm.updatedComponentTitle(data);
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ export class ListOfJumpsComponent implements OnInit {
|
|||||||
openDialog(item: Jump, editMode: boolean) {
|
openDialog(item: Jump, editMode: boolean) {
|
||||||
this.dialog.open(JumpInfosComponent, {
|
this.dialog.open(JumpInfosComponent, {
|
||||||
data: { jump: item, editMode: editMode },
|
data: { jump: item, editMode: editMode },
|
||||||
maxHeight: "400px",
|
maxHeight: "450px",
|
||||||
minWidth: "350px",
|
minWidth: "350px",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -33,7 +33,7 @@
|
|||||||
<mat-nav-list>
|
<mat-nav-list>
|
||||||
@for (stat of stats; track stat) {
|
@for (stat of stats; track stat) {
|
||||||
<mat-list-item matListItemLine>
|
<mat-list-item matListItemLine>
|
||||||
<label>{{ stat.id }} : {{ stat.values }}</label>
|
<label>{{ stat.label }} : {{ stat.hoursAndMinutes.hours }}h {{ stat.hoursAndMinutes.minutes }}m</label>
|
||||||
</mat-list-item>
|
</mat-list-item>
|
||||||
}
|
}
|
||||||
</mat-nav-list>
|
</mat-nav-list>
|
||||||
|
|||||||
+35
-9
@@ -59,7 +59,13 @@ export class ListOfTunnelFlightsComponent implements OnInit {
|
|||||||
"flightDate",
|
"flightDate",
|
||||||
"actions",
|
"actions",
|
||||||
];
|
];
|
||||||
public stats: Array<{ id: String | Number; values: String | Number }> = [];
|
public stats: Array<{
|
||||||
|
label: String;
|
||||||
|
hoursAndMinutes: {
|
||||||
|
hours: number;
|
||||||
|
minutes: number;
|
||||||
|
};
|
||||||
|
}> = [];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private serviceComm: ServiceComm,
|
private serviceComm: ServiceComm,
|
||||||
@@ -92,6 +98,14 @@ export class ListOfTunnelFlightsComponent implements OnInit {
|
|||||||
this.getDataForTable();
|
this.getDataForTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public delete(item: TunnelFlight) {
|
||||||
|
let data: Array<TunnelFlight> = this.dataSourceTable.data;
|
||||||
|
data = data.filter((d) => d.id !== item.id);
|
||||||
|
|
||||||
|
this.dataSourceTable.data = data;
|
||||||
|
this.serviceTunnelFlight.deleteTunnelFlight(item);
|
||||||
|
}
|
||||||
|
|
||||||
private chartConfig() {
|
private chartConfig() {
|
||||||
this.barChartType = "bar";
|
this.barChartType = "bar";
|
||||||
this.barChartOptions = {
|
this.barChartOptions = {
|
||||||
@@ -190,15 +204,25 @@ export class ListOfTunnelFlightsComponent implements OnInit {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
map((arr) => ({
|
map((arr) => ({
|
||||||
id: arr[0],
|
label: arr[0],
|
||||||
values: arr
|
values: arr
|
||||||
.slice(1)
|
.slice(1)
|
||||||
.reduce((a, b) => Number(a) + Number(b), 0),
|
.reduce((a, b) => Number(a) + Number(b), 0),
|
||||||
|
hoursAndMinutes: {},
|
||||||
})),
|
})),
|
||||||
)
|
)
|
||||||
.subscribe((p) => {
|
.subscribe((p) => {
|
||||||
console.log(p);
|
let newStat: {
|
||||||
this.stats.push(p);
|
label: String;
|
||||||
|
hoursAndMinutes: {
|
||||||
|
hours: number;
|
||||||
|
minutes: number;
|
||||||
|
};
|
||||||
|
} = {
|
||||||
|
label: p.label.toString(),
|
||||||
|
hoursAndMinutes: this.toHoursAndMinutes(+p.values),
|
||||||
|
};
|
||||||
|
this.stats.push(newStat);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -285,11 +309,13 @@ export class ListOfTunnelFlightsComponent implements OnInit {
|
|||||||
return beginDate;
|
return beginDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public delete(item: TunnelFlight) {
|
private toHoursAndMinutes(totalMinutes: number): {
|
||||||
let data: Array<TunnelFlight> = this.dataSourceTable.data;
|
hours: number;
|
||||||
data = data.filter((d) => d.id !== item.id);
|
minutes: number;
|
||||||
|
} {
|
||||||
|
const hours = Math.floor(totalMinutes / 60);
|
||||||
|
const minutes = totalMinutes % 60;
|
||||||
|
|
||||||
this.dataSourceTable.data = data;
|
return { hours, minutes };
|
||||||
this.serviceTunnelFlight.deleteTunnelFlight(item);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-card-title>
|
</mat-card-title>
|
||||||
<mat-card-subtitle style="font-size: 12px">
|
<mat-card-subtitle style="font-size: 12px; text-align: center;">
|
||||||
{{ "App_Footer" | translate }}{{ version }} - @Séb
|
{{ "App_Footer" | translate }}{{ version }} - @Séb
|
||||||
</mat-card-subtitle>
|
</mat-card-subtitle>
|
||||||
</mat-card-header>
|
</mat-card-header>
|
||||||
|
|||||||
@@ -152,6 +152,16 @@
|
|||||||
</button>
|
</button>
|
||||||
}
|
}
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>{{ "NewJump_Equipment" | translate }}</mat-label>
|
||||||
|
<mat-select [(value)]="selectedEquipment">
|
||||||
|
@for (equipment of listOfEquipment; track equipment) {
|
||||||
|
<mat-option [value]="equipment.value">{{
|
||||||
|
equipment.viewValue
|
||||||
|
}}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
<mat-checkbox [(ngModel)]="withCutaway" name="withCutaway">{{
|
<mat-checkbox [(ngModel)]="withCutaway" name="withCutaway">{{
|
||||||
"NewJump_Cutaway" | translate
|
"NewJump_Cutaway" | translate
|
||||||
}}</mat-checkbox>
|
}}</mat-checkbox>
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import { MatProgressSpinnerModule } from "@angular/material/progress-spinner";
|
|||||||
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
|
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
|
||||||
import { MatInputModule } from "@angular/material/input";
|
import { MatInputModule } from "@angular/material/input";
|
||||||
import { MatButtonModule } from "@angular/material/button";
|
import { MatButtonModule } from "@angular/material/button";
|
||||||
|
import { MatSelectModule } from "@angular/material/select";
|
||||||
|
|
||||||
import { JumpTypeResp } from "../../models/jumpType";
|
import { JumpTypeResp } from "../../models/jumpType";
|
||||||
import { AircraftResp } from "../../models/aircraft";
|
import { AircraftResp } from "../../models/aircraft";
|
||||||
@@ -48,6 +49,11 @@ class PickDateAdapter extends NativeDateAdapter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface Equipment {
|
||||||
|
value: string;
|
||||||
|
viewValue: string;
|
||||||
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-new-jump",
|
selector: "app-new-jump",
|
||||||
templateUrl: "./new-jump.component.html",
|
templateUrl: "./new-jump.component.html",
|
||||||
@@ -72,6 +78,7 @@ class PickDateAdapter extends NativeDateAdapter {
|
|||||||
ReactiveFormsModule,
|
ReactiveFormsModule,
|
||||||
MatInputModule,
|
MatInputModule,
|
||||||
MatButtonModule,
|
MatButtonModule,
|
||||||
|
MatSelectModule,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class NewJumpComponent implements OnInit {
|
export class NewJumpComponent implements OnInit {
|
||||||
@@ -96,6 +103,15 @@ export class NewJumpComponent implements OnInit {
|
|||||||
private pendingAddRequest: boolean;
|
private pendingAddRequest: boolean;
|
||||||
private listOfDropZone: Array<DropZoneResp>;
|
private listOfDropZone: Array<DropZoneResp>;
|
||||||
public maxDate: Date;
|
public maxDate: Date;
|
||||||
|
public selectedEquipment: string = "";
|
||||||
|
public listOfEquipment: Array<Equipment> = [
|
||||||
|
{ value: "", viewValue: "<None>" },
|
||||||
|
{ value: "Freak 6", viewValue: "Freak 6" },
|
||||||
|
{ value: "ATC 4", viewValue: "ATC 4" },
|
||||||
|
{ value: "ATC 2", viewValue: "ATC 2" },
|
||||||
|
{ value: "Havok", viewValue: "Havok" },
|
||||||
|
{ value: "Hawk", viewValue: "Hawk" },
|
||||||
|
];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private serviceComm: ServiceComm,
|
private serviceComm: ServiceComm,
|
||||||
@@ -142,10 +158,12 @@ export class NewJumpComponent implements OnInit {
|
|||||||
this.countOfJumps,
|
this.countOfJumps,
|
||||||
this.comments,
|
this.comments,
|
||||||
this.isSpecial === undefined ? false : this.isSpecial,
|
this.isSpecial === undefined ? false : this.isSpecial,
|
||||||
|
this.selectedEquipment,
|
||||||
)
|
)
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
this.statsService.resetStats();
|
this.statsService.resetStats();
|
||||||
this.comments = undefined;
|
this.comments = undefined;
|
||||||
|
this.selectedEquipment = "";
|
||||||
this.withCutaway = false;
|
this.withCutaway = false;
|
||||||
this.isSpecial = false;
|
this.isSpecial = false;
|
||||||
|
|
||||||
@@ -233,6 +251,7 @@ export class NewJumpComponent implements OnInit {
|
|||||||
|
|
||||||
this.listOfFilteredDropZone = this.listOfDropZone;
|
this.listOfFilteredDropZone = this.listOfDropZone;
|
||||||
this.comments = undefined;
|
this.comments = undefined;
|
||||||
|
this.selectedEquipment = "";
|
||||||
|
|
||||||
this.withCutaway = false;
|
this.withCutaway = false;
|
||||||
this.isSpecial = false;
|
this.isSpecial = false;
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ export class SummaryComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public refreshStats() {
|
public refreshStats() {
|
||||||
|
this.serviceApi.resetStats();
|
||||||
this.serviceApi.deleteAllCache();
|
this.serviceApi.deleteAllCache();
|
||||||
this.tabGroup.selectedIndex = 0;
|
this.tabGroup.selectedIndex = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,6 +120,7 @@
|
|||||||
"NewJump_Count": "Count of jumps",
|
"NewJump_Count": "Count of jumps",
|
||||||
"NewJump_Comments": "Comments",
|
"NewJump_Comments": "Comments",
|
||||||
"NewJump_Submit": "Submit",
|
"NewJump_Submit": "Submit",
|
||||||
|
"NewJump_Equipment": "Equipment",
|
||||||
|
|
||||||
"NewTunnelFlight_ChooseTunnel": "Choose the tunnel",
|
"NewTunnelFlight_ChooseTunnel": "Choose the tunnel",
|
||||||
"NewTunnelFlight_Minutes": "Minutes of the flight",
|
"NewTunnelFlight_Minutes": "Minutes of the flight",
|
||||||
@@ -143,5 +144,13 @@
|
|||||||
"UserProfile_Mail": "E-mail",
|
"UserProfile_Mail": "E-mail",
|
||||||
"UserProfile_Lastname": "Lastname",
|
"UserProfile_Lastname": "Lastname",
|
||||||
"UserProfile_Firstname": "Firstname",
|
"UserProfile_Firstname": "Firstname",
|
||||||
"UserProfile_Login": "Login"
|
"UserProfile_Login": "Login",
|
||||||
|
|
||||||
|
"GearInfos_Name": "Name",
|
||||||
|
"GearInfos_Manufacturer": "Manufacturer",
|
||||||
|
"GearInfos_MinSize": "Min size",
|
||||||
|
"GearInfos_MaxSize": "Max size",
|
||||||
|
"GearInfos_AAD": "AAD system",
|
||||||
|
"GearInfos_MainCanopy": "Main canopy",
|
||||||
|
"GearInfos_ReserveCanopy": "Reserve canopy"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,6 +120,7 @@
|
|||||||
"NewJump_Count": "Nombre de sauts",
|
"NewJump_Count": "Nombre de sauts",
|
||||||
"NewJump_Comments": "Commentaires",
|
"NewJump_Comments": "Commentaires",
|
||||||
"NewJump_Submit": "Ajouter",
|
"NewJump_Submit": "Ajouter",
|
||||||
|
"NewJump_Equipment": "Équipment",
|
||||||
|
|
||||||
"NewTunnelFlight_ChooseTunnel": "Choisir le tunnel",
|
"NewTunnelFlight_ChooseTunnel": "Choisir le tunnel",
|
||||||
"NewTunnelFlight_Minutes": "Temps de vol(minutes)",
|
"NewTunnelFlight_Minutes": "Temps de vol(minutes)",
|
||||||
@@ -143,5 +144,13 @@
|
|||||||
"UserProfile_Mail": "E-mail",
|
"UserProfile_Mail": "E-mail",
|
||||||
"UserProfile_Lastname": "Nom",
|
"UserProfile_Lastname": "Nom",
|
||||||
"UserProfile_Firstname": "Prénom",
|
"UserProfile_Firstname": "Prénom",
|
||||||
"UserProfile_Login": "Identifiant"
|
"UserProfile_Login": "Identifiant",
|
||||||
|
|
||||||
|
"GearInfos_Name": "Nom",
|
||||||
|
"GearInfos_Manufacturer": "Fabriquant",
|
||||||
|
"GearInfos_MinSize": "Taille min",
|
||||||
|
"GearInfos_MaxSize": "Taile max",
|
||||||
|
"GearInfos_AAD": "Système de sécurité",
|
||||||
|
"GearInfos_MainCanopy": "Voile principale",
|
||||||
|
"GearInfos_ReserveCanopy": "Voile de secours"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,29 +1,29 @@
|
|||||||
export class GearReq {
|
export class GearReq {
|
||||||
constructor(data: any) {
|
constructor(data: any) {
|
||||||
Object.assign(this, data);
|
Object.assign(this, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public id: number;
|
public id: number;
|
||||||
public name: string;
|
public name: string;
|
||||||
public manufacturer: string;
|
public manufacturer: string;
|
||||||
public minSize: number;
|
public minSize: number;
|
||||||
public maxSize: number;
|
public maxSize: number;
|
||||||
public aad: string;
|
public aad: string;
|
||||||
public mainCanopy: string;
|
public mainCanopy: string;
|
||||||
public reserveCanopy: string;
|
public reserveCanopy: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GearResp {
|
export class GearResp {
|
||||||
constructor(data: any) {
|
constructor(data: any) {
|
||||||
Object.assign(this, data);
|
Object.assign(this, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public id: number;
|
public id: number;
|
||||||
public name: string;
|
public name: string;
|
||||||
public manufacturer: string;
|
public manufacturer: string;
|
||||||
public minSize: number;
|
public minSize: number;
|
||||||
public maxSize: number;
|
public maxSize: number;
|
||||||
public aad: string;
|
public aad: string;
|
||||||
public mainCanopy: string;
|
public mainCanopy: string;
|
||||||
public reserveCanopy: string;
|
public reserveCanopy: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,66 +1,69 @@
|
|||||||
import { GearResp } from './gear';
|
import { GearResp } from "./gear";
|
||||||
import { DropZoneResp } from './dropzone';
|
import { DropZoneResp } from "./dropzone";
|
||||||
import { AircraftResp } from './aircraft';
|
import { AircraftResp } from "./aircraft";
|
||||||
import { JumpTypeResp } from './jumpType';
|
import { JumpTypeResp } from "./jumpType";
|
||||||
|
|
||||||
export class JumpReq {
|
export class JumpReq {
|
||||||
constructor(data: any) {
|
constructor(data: any) {
|
||||||
Object.assign(this, data);
|
Object.assign(this, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public id: number;
|
public id: number;
|
||||||
public jumpTypeId: number;
|
public jumpTypeId: number;
|
||||||
public aircraftId: number;
|
public aircraftId: number;
|
||||||
public dropZoneId: number;
|
public dropZoneId: number;
|
||||||
public gearId: number;
|
public gearId: number;
|
||||||
public exitAltitude: number;
|
public exitAltitude: number;
|
||||||
public deployAltitude: number;
|
public deployAltitude: number;
|
||||||
public withCutaway: boolean;
|
public withCutaway: boolean;
|
||||||
public notes: string;
|
public notes: string;
|
||||||
public jumpDate: string;
|
public jumpDate: string;
|
||||||
public isSpecial: boolean;
|
public isSpecial: boolean;
|
||||||
|
public equipment: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class JumpResp {
|
export class JumpResp {
|
||||||
constructor(data: any) {
|
constructor(data: any) {
|
||||||
Object.assign(this, data);
|
Object.assign(this, data);
|
||||||
this.jumpDate = new Date(data.jumpDate);
|
this.jumpDate = new Date(data.jumpDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
public id: number;
|
public id: number;
|
||||||
public jumpType: JumpTypeResp;
|
public jumpType: JumpTypeResp;
|
||||||
public aircraft: AircraftResp;
|
public aircraft: AircraftResp;
|
||||||
public dropZone: DropZoneResp;
|
public dropZone: DropZoneResp;
|
||||||
public gear: GearResp;
|
public gear: GearResp;
|
||||||
|
|
||||||
public jumpTypeId: number;
|
public jumpTypeId: number;
|
||||||
public aircraftId: number;
|
public aircraftId: number;
|
||||||
public dropZoneId: number;
|
public dropZoneId: number;
|
||||||
public gearId: number;
|
public gearId: number;
|
||||||
|
|
||||||
public exitAltitude: number;
|
public exitAltitude: number;
|
||||||
public deployAltitude: number;
|
public deployAltitude: number;
|
||||||
public withCutaway: boolean;
|
public withCutaway: boolean;
|
||||||
public notes: string;
|
public notes: string;
|
||||||
public jumpDate: Date;
|
public jumpDate: Date;
|
||||||
public isSpecial: boolean;
|
public isSpecial: boolean;
|
||||||
|
public equipment: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Jump {
|
export class Jump {
|
||||||
constructor(data: any) {
|
constructor(data: any) {
|
||||||
Object.assign(this, data);
|
Object.assign(this, data);
|
||||||
this.jumpDate = new Date(data.jumpDate);
|
this.jumpDate = new Date(data.jumpDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
public id: number;
|
public id: number;
|
||||||
public jumpType: JumpTypeResp;
|
public jumpType: JumpTypeResp;
|
||||||
public aircraft: AircraftResp;
|
public aircraft: AircraftResp;
|
||||||
public dropZone: DropZoneResp;
|
public dropZone: DropZoneResp;
|
||||||
public gear: GearResp;
|
public gear: GearResp;
|
||||||
public exitAltitude: number;
|
public exitAltitude: number;
|
||||||
public deployAltitude: number;
|
public deployAltitude: number;
|
||||||
public withCutaway: boolean;
|
public withCutaway: boolean;
|
||||||
public notes: string;
|
public notes: string;
|
||||||
public jumpDate: Date;
|
public jumpDate: Date;
|
||||||
public isSpecial: boolean;
|
public isSpecial: boolean;
|
||||||
}
|
public equipment: string;
|
||||||
|
}
|
||||||
|
|||||||
@@ -10,46 +10,85 @@ import { CacheApiKey } from "../models/cache-api-key.enum";
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class GearService extends BaseService {
|
export class GearService extends BaseService {
|
||||||
constructor(private http: HttpClient) {
|
constructor(private http: HttpClient) {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public getListOfGears(): Observable<Array<GearResp>> {
|
public getListOfGears(): Observable<Array<GearResp>> {
|
||||||
let callToApi = this.http.get<Array<GearResp>>(`${this.apiUrl}/Gear`, { headers: this.headers });
|
let callToApi = this.http.get<Array<GearResp>>(`${this.apiUrl}/Gear`, {
|
||||||
return this.serviceCacheApi.get<Array<GearResp>>(CacheApiKey.Gear, callToApi);
|
headers: this.headers,
|
||||||
}
|
});
|
||||||
|
return this.serviceCacheApi.get<Array<GearResp>>(
|
||||||
|
CacheApiKey.Gear,
|
||||||
|
callToApi,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public addGear(name: string,
|
public addGear(
|
||||||
manufacturer: string,
|
name: string,
|
||||||
minSize: number,
|
manufacturer: string,
|
||||||
maxSize: number,
|
minSize: number,
|
||||||
aad: string,
|
maxSize: number,
|
||||||
mainCanopy: string,
|
aad: string,
|
||||||
reserveCanopy: string)
|
mainCanopy: string,
|
||||||
{
|
reserveCanopy: string,
|
||||||
const bodyNewGear: GearReq = {
|
) {
|
||||||
id: 0,
|
const bodyNewGear: GearReq = {
|
||||||
name: name,
|
id: 0,
|
||||||
manufacturer: manufacturer,
|
name: name,
|
||||||
minSize: minSize,
|
manufacturer: manufacturer,
|
||||||
maxSize: maxSize,
|
minSize: minSize,
|
||||||
aad: aad,
|
maxSize: maxSize,
|
||||||
mainCanopy: mainCanopy,
|
aad: aad,
|
||||||
reserveCanopy: reserveCanopy
|
mainCanopy: mainCanopy,
|
||||||
};
|
reserveCanopy: reserveCanopy,
|
||||||
|
};
|
||||||
|
|
||||||
this.serviceCacheApi.delete(CacheApiKey.Gear);
|
this.serviceCacheApi.delete(CacheApiKey.Gear);
|
||||||
return this.http.post(`${this.apiUrl}/Gear`, bodyNewGear, { headers: this.headers});
|
return this.http.post(`${this.apiUrl}/Gear`, bodyNewGear, {
|
||||||
}
|
headers: this.headers,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public getById(id: number) : Observable<GearResp> {
|
public getById(id: number): Observable<GearResp> {
|
||||||
return this.serviceCacheApi.getByKey<Array<GearResp>>(CacheApiKey.Gear)
|
return this.serviceCacheApi
|
||||||
.pipe(map(data => {
|
.getByKey<Array<GearResp>>(CacheApiKey.Gear)
|
||||||
return data.find(f => f.id === id);
|
.pipe(
|
||||||
}));
|
map((data) => {
|
||||||
}
|
return data.find((f) => f.id === id);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public getFromCache(): Observable<Array<GearResp>> {
|
public getFromCache(): Observable<Array<GearResp>> {
|
||||||
return this.serviceCacheApi.getByKey<Array<GearResp>>(CacheApiKey.Gear);
|
return this.serviceCacheApi.getByKey<Array<GearResp>>(CacheApiKey.Gear);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public updateGear(
|
||||||
|
id: number,
|
||||||
|
name: string,
|
||||||
|
manufacturer: string,
|
||||||
|
minSize: number,
|
||||||
|
maxSize: number,
|
||||||
|
aad: string,
|
||||||
|
mainCanopy: string,
|
||||||
|
reserveCanopy: string,
|
||||||
|
) {
|
||||||
|
const gearData = {
|
||||||
|
id: id,
|
||||||
|
name: name,
|
||||||
|
manufacturer: manufacturer,
|
||||||
|
minSize: minSize,
|
||||||
|
maxSize: maxSize,
|
||||||
|
aad: aad,
|
||||||
|
mainCanopy: mainCanopy,
|
||||||
|
reserveCanopy: reserveCanopy,
|
||||||
|
};
|
||||||
|
const bodyUpdatedGear = new GearReq(gearData);
|
||||||
|
|
||||||
|
this.serviceCacheApi.delete(CacheApiKey.Gear);
|
||||||
|
return this.http.put(`${this.apiUrl}/Gear/${id}`, bodyUpdatedGear, {
|
||||||
|
headers: this.headers,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Injectable } from "@angular/core";
|
import { Injectable } from "@angular/core";
|
||||||
import { HttpClient } from "@angular/common/http";
|
import { HttpClient } from "@angular/common/http";
|
||||||
import { DatePipe } from '@angular/common';
|
import { DatePipe } from "@angular/common";
|
||||||
import { forkJoin, Observable } from "rxjs";
|
import { forkJoin, Observable } from "rxjs";
|
||||||
import { map } from "rxjs/operators";
|
import { map } from "rxjs/operators";
|
||||||
|
|
||||||
@@ -20,158 +20,204 @@ import { GearService } from "./gear.service";
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class JumpService extends BaseService {
|
export class JumpService extends BaseService {
|
||||||
private callsToAdd: Array<Observable<any>>;
|
private callsToAdd: Array<Observable<any>>;
|
||||||
|
|
||||||
constructor(private http: HttpClient,
|
constructor(
|
||||||
private dateService: DateService,
|
private http: HttpClient,
|
||||||
private datePipe: DatePipe,
|
private dateService: DateService,
|
||||||
private dropzoneService: DropzoneService,
|
private datePipe: DatePipe,
|
||||||
private aircraftService: AircraftService,
|
private dropzoneService: DropzoneService,
|
||||||
private jumpTypeService: JumpTypeService,
|
private aircraftService: AircraftService,
|
||||||
private gearService: GearService) {
|
private jumpTypeService: JumpTypeService,
|
||||||
super();
|
private gearService: GearService,
|
||||||
}
|
) {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
public getListOfJumps(): Observable<Array<Jump>> {
|
public getListOfJumps(): Observable<Array<Jump>> {
|
||||||
return this.http.get<Array<JumpResp>>(`${this.apiUrl}/Jump`, { headers: this.headers })
|
return this.http
|
||||||
.pipe(map((response) => {
|
.get<
|
||||||
return this.mapWithDataInCache(response);
|
Array<JumpResp>
|
||||||
}));
|
>(`${this.apiUrl}/Jump`, { headers: this.headers })
|
||||||
}
|
.pipe(
|
||||||
|
map((response) => {
|
||||||
|
return this.mapWithDataInCache(response);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public getJumps(beginIndex: number, endIndex: number): Observable<JumpList> {
|
public getJumps(
|
||||||
return this.http.get<JumpListResp>(`${this.apiUrl}/Jump/${beginIndex}/${endIndex}`, { headers: this.headers })
|
beginIndex: number,
|
||||||
.pipe(map(response => {
|
endIndex: number,
|
||||||
let result: JumpList = {
|
): Observable<JumpList> {
|
||||||
|
return this.http
|
||||||
|
.get<JumpListResp>(
|
||||||
|
`${this.apiUrl}/Jump/${beginIndex}/${endIndex}`,
|
||||||
|
{ headers: this.headers },
|
||||||
|
)
|
||||||
|
.pipe(
|
||||||
|
map((response) => {
|
||||||
|
let result: JumpList = {
|
||||||
rows: this.mapWithDataInCache(response.rows),
|
rows: this.mapWithDataInCache(response.rows),
|
||||||
count: response.count
|
count: response.count,
|
||||||
};
|
};
|
||||||
|
|
||||||
return new JumpList(result);
|
return new JumpList(result);
|
||||||
}));
|
}),
|
||||||
}
|
);
|
||||||
|
|
||||||
public addListOfJump(selectedJumpType: number,
|
|
||||||
selectedAircraft: number,
|
|
||||||
selectedDz: number,
|
|
||||||
selectedRig: number,
|
|
||||||
withCutaway: boolean,
|
|
||||||
beginDate: Date,
|
|
||||||
endDate: Date,
|
|
||||||
defaultExitAltitude: number,
|
|
||||||
defaultDeployAltitude: number,
|
|
||||||
countOfJumps: number,
|
|
||||||
notes: string,
|
|
||||||
isSpecial: boolean): Observable<any[]> {
|
|
||||||
this.callsToAdd = new Array<Observable<any>>();
|
|
||||||
const diffInDays = this.dateService.diffBetweenDates(beginDate, endDate) + 1;
|
|
||||||
const countOfJumpsPerDay = Math.trunc(countOfJumps / diffInDays);
|
|
||||||
|
|
||||||
for (let i = 1; beginDate.getTime() < endDate.getTime(); i++) {
|
|
||||||
this.addJumps(selectedJumpType,
|
|
||||||
selectedAircraft,
|
|
||||||
selectedDz,
|
|
||||||
selectedRig,
|
|
||||||
withCutaway,
|
|
||||||
beginDate,
|
|
||||||
defaultExitAltitude,
|
|
||||||
defaultDeployAltitude,
|
|
||||||
countOfJumpsPerDay,
|
|
||||||
notes,
|
|
||||||
isSpecial);
|
|
||||||
|
|
||||||
beginDate = this.dateService.addDays(beginDate, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const restfJumps = countOfJumps - countOfJumpsPerDay * (diffInDays - 1);
|
public addListOfJump(
|
||||||
|
selectedJumpType: number,
|
||||||
|
selectedAircraft: number,
|
||||||
|
selectedDz: number,
|
||||||
|
selectedGear: number,
|
||||||
|
withCutaway: boolean,
|
||||||
|
beginDate: Date,
|
||||||
|
endDate: Date,
|
||||||
|
defaultExitAltitude: number,
|
||||||
|
defaultDeployAltitude: number,
|
||||||
|
countOfJumps: number,
|
||||||
|
notes: string,
|
||||||
|
isSpecial: boolean,
|
||||||
|
equipment: string,
|
||||||
|
): Observable<any[]> {
|
||||||
|
this.callsToAdd = new Array<Observable<any>>();
|
||||||
|
const diffInDays =
|
||||||
|
this.dateService.diffBetweenDates(beginDate, endDate) + 1;
|
||||||
|
const countOfJumpsPerDay = Math.trunc(countOfJumps / diffInDays);
|
||||||
|
|
||||||
this.addJumps(selectedJumpType,
|
for (let i = 1; beginDate.getTime() < endDate.getTime(); i++) {
|
||||||
selectedAircraft,
|
this.addJumps(
|
||||||
selectedDz,
|
selectedJumpType,
|
||||||
selectedRig,
|
selectedAircraft,
|
||||||
withCutaway,
|
selectedDz,
|
||||||
beginDate,
|
selectedGear,
|
||||||
defaultExitAltitude,
|
withCutaway,
|
||||||
defaultDeployAltitude,
|
beginDate,
|
||||||
restfJumps,
|
defaultExitAltitude,
|
||||||
notes,
|
defaultDeployAltitude,
|
||||||
isSpecial);
|
countOfJumpsPerDay,
|
||||||
|
notes,
|
||||||
|
isSpecial,
|
||||||
|
equipment,
|
||||||
|
);
|
||||||
|
|
||||||
return forkJoin(this.callsToAdd);
|
beginDate = this.dateService.addDays(beginDate, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public deleteJump(item: Jump) {
|
const restfJumps = countOfJumps - countOfJumpsPerDay * (diffInDays - 1);
|
||||||
this.http.delete(`${this.apiUrl}/Jump/${item.id}`, { headers: this.headers }).subscribe();
|
|
||||||
}
|
|
||||||
|
|
||||||
public updateJump(id: number,
|
this.addJumps(
|
||||||
isSpecial: boolean,
|
selectedJumpType,
|
||||||
withCutaway: boolean,
|
selectedAircraft,
|
||||||
notes: string) {
|
selectedDz,
|
||||||
const jumpData = {
|
selectedGear,
|
||||||
id: id,
|
withCutaway,
|
||||||
isSpecial: isSpecial,
|
beginDate,
|
||||||
withCutaway: withCutaway,
|
defaultExitAltitude,
|
||||||
notes: notes
|
defaultDeployAltitude,
|
||||||
};
|
restfJumps,
|
||||||
const bodyUpdatedJump = new JumpReq(jumpData);
|
notes,
|
||||||
|
isSpecial,
|
||||||
|
equipment,
|
||||||
|
);
|
||||||
|
|
||||||
return this.http.put(`${this.apiUrl}/Jump/${id}`,
|
return forkJoin(this.callsToAdd);
|
||||||
bodyUpdatedJump,
|
|
||||||
{ headers: this.headers, });
|
|
||||||
}
|
|
||||||
|
|
||||||
private addJumps(selectedJumpType: number,
|
|
||||||
selectedAircraft: number,
|
|
||||||
selectedDz: number,
|
|
||||||
selectedRig: number,
|
|
||||||
withCutaway: boolean,
|
|
||||||
jumpDate: Date,
|
|
||||||
defaultExitAltitude: number,
|
|
||||||
defaultDeployAltitude: number,
|
|
||||||
countOfJumps: number,
|
|
||||||
notes: string,
|
|
||||||
isSpecial: boolean) {
|
|
||||||
for (let i = 0; i < countOfJumps; i++) {
|
|
||||||
const bodyNewjump: JumpReq = {
|
|
||||||
jumpTypeId: selectedJumpType,
|
|
||||||
aircraftId: selectedAircraft,
|
|
||||||
dropZoneId: selectedDz,
|
|
||||||
withCutaway: withCutaway,
|
|
||||||
exitAltitude: defaultExitAltitude,
|
|
||||||
deployAltitude: defaultDeployAltitude,
|
|
||||||
gearId: selectedRig,
|
|
||||||
notes: notes,
|
|
||||||
id: 0,
|
|
||||||
jumpDate: this.datePipe.transform(jumpDate, "yyyy-MM-dd"),
|
|
||||||
isSpecial: isSpecial
|
|
||||||
};
|
|
||||||
|
|
||||||
let call = this.http.post(`${this.apiUrl}/Jump`, bodyNewjump, { headers: this.headers });
|
|
||||||
|
|
||||||
this.callsToAdd.push(call);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private mapWithDataInCache(apiResp: Array<JumpResp>): Array<Jump> {
|
public deleteJump(item: Jump) {
|
||||||
let allDropzones: Array<DropZoneResp>;
|
this.http
|
||||||
this.dropzoneService.getFromCache().subscribe(data => { allDropzones = data; });
|
.delete(`${this.apiUrl}/Jump/${item.id}`, { headers: this.headers })
|
||||||
let allAircrafts: Array<AircraftResp>;
|
.subscribe();
|
||||||
this.aircraftService.getFromCache().subscribe(data => { allAircrafts = data; });
|
}
|
||||||
let allJumpType: Array<JumpTypeResp>;
|
|
||||||
this.jumpTypeService.getFromCache().subscribe(data => { allJumpType = data; });
|
|
||||||
let allGears: Array<GearResp>;
|
|
||||||
this.gearService.getFromCache().subscribe(data => { allGears = data; });
|
|
||||||
|
|
||||||
return apiResp.map((data) => {
|
public updateJump(
|
||||||
let tmp = new Jump(data);
|
id: number,
|
||||||
|
isSpecial: boolean,
|
||||||
|
withCutaway: boolean,
|
||||||
|
notes: string,
|
||||||
|
equipment: string,
|
||||||
|
) {
|
||||||
|
const jumpData = {
|
||||||
|
id: id,
|
||||||
|
isSpecial: isSpecial,
|
||||||
|
withCutaway: withCutaway,
|
||||||
|
notes: notes,
|
||||||
|
equipment: equipment,
|
||||||
|
};
|
||||||
|
const bodyUpdatedJump = new JumpReq(jumpData);
|
||||||
|
|
||||||
tmp.dropZone = allDropzones.find(d => d.id == data.dropZoneId);
|
return this.http.put(`${this.apiUrl}/Jump/${id}`, bodyUpdatedJump, {
|
||||||
tmp.aircraft = allAircrafts.find(d => d.id == data.aircraftId);
|
headers: this.headers,
|
||||||
tmp.jumpType = allJumpType.find(d => d.id == data.jumpTypeId);
|
});
|
||||||
tmp.gear = allGears.find(d => d.id == data.gearId);
|
}
|
||||||
|
|
||||||
return tmp;
|
private addJumps(
|
||||||
});
|
selectedJumpType: number,
|
||||||
}
|
selectedAircraft: number,
|
||||||
|
selectedDz: number,
|
||||||
|
selectedGear: number,
|
||||||
|
withCutaway: boolean,
|
||||||
|
jumpDate: Date,
|
||||||
|
defaultExitAltitude: number,
|
||||||
|
defaultDeployAltitude: number,
|
||||||
|
countOfJumps: number,
|
||||||
|
notes: string,
|
||||||
|
isSpecial: boolean,
|
||||||
|
equipment: string,
|
||||||
|
) {
|
||||||
|
for (let i = 0; i < countOfJumps; i++) {
|
||||||
|
const bodyNewjump: JumpReq = {
|
||||||
|
jumpTypeId: selectedJumpType,
|
||||||
|
aircraftId: selectedAircraft,
|
||||||
|
dropZoneId: selectedDz,
|
||||||
|
withCutaway: withCutaway,
|
||||||
|
exitAltitude: defaultExitAltitude,
|
||||||
|
deployAltitude: defaultDeployAltitude,
|
||||||
|
gearId: selectedGear,
|
||||||
|
notes: notes,
|
||||||
|
id: 0,
|
||||||
|
jumpDate: this.datePipe.transform(jumpDate, "yyyy-MM-dd"),
|
||||||
|
isSpecial: isSpecial,
|
||||||
|
equipment: equipment,
|
||||||
|
};
|
||||||
|
|
||||||
|
let call = this.http.post(`${this.apiUrl}/Jump`, bodyNewjump, {
|
||||||
|
headers: this.headers,
|
||||||
|
});
|
||||||
|
|
||||||
|
this.callsToAdd.push(call);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private mapWithDataInCache(apiResp: Array<JumpResp>): Array<Jump> {
|
||||||
|
let allDropzones: Array<DropZoneResp>;
|
||||||
|
this.dropzoneService.getFromCache().subscribe((data) => {
|
||||||
|
allDropzones = data;
|
||||||
|
});
|
||||||
|
let allAircrafts: Array<AircraftResp>;
|
||||||
|
this.aircraftService.getFromCache().subscribe((data) => {
|
||||||
|
allAircrafts = data;
|
||||||
|
});
|
||||||
|
let allJumpType: Array<JumpTypeResp>;
|
||||||
|
this.jumpTypeService.getFromCache().subscribe((data) => {
|
||||||
|
allJumpType = data;
|
||||||
|
});
|
||||||
|
let allGears: Array<GearResp>;
|
||||||
|
this.gearService.getFromCache().subscribe((data) => {
|
||||||
|
allGears = data;
|
||||||
|
});
|
||||||
|
|
||||||
|
return apiResp.map((data) => {
|
||||||
|
let tmp = new Jump(data);
|
||||||
|
|
||||||
|
tmp.dropZone = allDropzones.find((d) => d.id == data.dropZoneId);
|
||||||
|
tmp.aircraft = allAircrafts.find((d) => d.id == data.aircraftId);
|
||||||
|
tmp.jumpType = allJumpType.find((d) => d.id == data.jumpTypeId);
|
||||||
|
tmp.gear = allGears.find((d) => d.id == data.gearId);
|
||||||
|
|
||||||
|
return tmp;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# Manual
|
||||||
|
## To build an image "skydivelogs" with the version "1.6.0":
|
||||||
|
podman build . -t skydivelogs:1.6.0
|
||||||
|
|
||||||
|
## To run ab image to container with volume :
|
||||||
|
podman run -v ./Front/skydivelogs-app/src/config:/usr/share/nginx/html/config:z -v ./Back/skydiveLogs-api/Data:/app/Data:z -d -p 5080:80/tcp --name Skydivelogs-1.6.0 -it skydivelogs:1.6.0
|
||||||
|
|
||||||
|
## To save the image before to updload to the server :
|
||||||
|
podman save --output skydivelogs-1.6.0.tar skydivelogs:1.6.0
|
||||||
|
|
||||||
|
## Updload to the server :
|
||||||
|
scp -P 5022 skydivelogs-1.6.0.tar administrator@51.75.68.58:~
|
||||||
|
|
||||||
|
# By a registry
|
||||||
|
podman login home.git.sebastienandre.com
|
||||||
|
podman build -t home.git.sebastienandre.com/sandre/skydivelogs:1.7.0 .
|
||||||
|
podman push home.git.sebastienandre.com/sandre/skydivelogs:1.7.0
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
To build an image "skydivelogs" with the version "1.6.0":
|
|
||||||
podman build . -t skydivelogs:1.6.0
|
|
||||||
|
|
||||||
To run ab image to container with volume :
|
|
||||||
podman run -v ./Front/skydivelogs-app/src/config:/usr/share/nginx/html/config:z -v ./Back/skydiveLogs-api/Data:/app/Data:z -d -p 5080:80/tcp --name Skydivelogs-1.6.0 -it skydivelogs:1.6.0
|
|
||||||
|
|
||||||
To save the image before to updload to the server :
|
|
||||||
podman save --output skydivelogs-1.6.0.tar skydivelogs:1.6.0
|
|
||||||
|
|
||||||
Updload to the server :
|
|
||||||
scp -P 5022 skydivelogs-1.6.0.tar administrator@51.75.68.58:~
|
|
||||||
Reference in New Issue
Block a user