Little test with AI + Add the equipment (#8)

Tests using local LLM AI to add comments in the C# files
For the flights tunnel, show the total to day/hours
For the jump, add the equipment (now just with the wingsuit)

Reviewed-on: #8
Co-authored-by: sandre <perso@sebastienandre.com>
Co-committed-by: sandre <perso@sebastienandre.com>
This commit was merged in pull request #8.
This commit is contained in:
2026-05-16 09:24:13 +00:00
committed by sandre
parent 0ebdbca549
commit ceed44f997
70 changed files with 12142 additions and 10444 deletions
@@ -1,10 +1,10 @@
using AutoMapper;
using System.Collections.Generic;
using AutoMapper;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using skydiveLogs_api.DataContract;
using skydiveLogs_api.Domain;
using skydiveLogs_api.DomainBusiness.Interfaces;
using System.Collections.Generic;
namespace skydiveLogs_api.Controllers
{
@@ -23,7 +23,10 @@ namespace skydiveLogs_api.Controllers
#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}")]
[EnableCors]
public void Delete(int id)
@@ -31,7 +34,10 @@ namespace skydiveLogs_api.Controllers
_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]
[EnableCors]
public IEnumerable<AircraftResp> Get()
@@ -40,7 +46,11 @@ namespace skydiveLogs_api.Controllers
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}")]
[EnableCors]
public AircraftResp Get(int id)
@@ -49,6 +59,10 @@ namespace skydiveLogs_api.Controllers
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")]
[EnableCors]
public IEnumerable<AircraftSimpleResp> GetSimple()
@@ -57,7 +71,10 @@ namespace skydiveLogs_api.Controllers
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]
[EnableCors]
public void Post([FromBody] AircraftReq value)
@@ -65,7 +82,11 @@ namespace skydiveLogs_api.Controllers
_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}")]
[EnableCors]
public void Put(int id, [FromBody] AircraftReq value)
@@ -82,4 +103,4 @@ namespace skydiveLogs_api.Controllers
#endregion Private Fields
}
}
}
@@ -1,10 +1,10 @@
using AutoMapper;
using System.Collections.Generic;
using AutoMapper;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using skydiveLogs_api.DataContract;
using skydiveLogs_api.Domain;
using skydiveLogs_api.DomainBusiness.Interfaces;
using System.Collections.Generic;
namespace skydiveLogs_api.Controllers
{
@@ -23,7 +23,11 @@ namespace skydiveLogs_api.Controllers
#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}")]
[EnableCors]
public bool AddToFavorite(int id)
@@ -31,7 +35,10 @@ namespace skydiveLogs_api.Controllers
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}")]
[EnableCors]
public void Delete(int id)
@@ -39,7 +46,10 @@ namespace skydiveLogs_api.Controllers
_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]
[EnableCors]
public IEnumerable<DropZoneResp> Get()
@@ -49,7 +59,11 @@ namespace skydiveLogs_api.Controllers
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}")]
[EnableCors]
public DropZoneResp Get(int id)
@@ -59,6 +73,10 @@ namespace skydiveLogs_api.Controllers
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")]
[EnableCors]
public IEnumerable<DropZoneSimpleResp> GetSimple()
@@ -68,7 +86,10 @@ namespace skydiveLogs_api.Controllers
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]
[EnableCors]
public void Post([FromBody] DropZoneReq value)
@@ -76,7 +97,12 @@ namespace skydiveLogs_api.Controllers
_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}")]
[EnableCors]
public bool Put(int id, [FromBody] DropZoneReq value)
@@ -84,7 +110,11 @@ namespace skydiveLogs_api.Controllers
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}")]
[EnableCors]
public bool RemoveToFavorite(int id)
@@ -101,4 +131,4 @@ namespace skydiveLogs_api.Controllers
#endregion Private Fields
}
}
}
@@ -1,10 +1,10 @@
using AutoMapper;
using System.Collections.Generic;
using AutoMapper;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using skydiveLogs_api.DataContract;
using skydiveLogs_api.Domain;
using skydiveLogs_api.DomainBusiness.Interfaces;
using System.Collections.Generic;
namespace skydiveLogs_api.Controllers
{
@@ -23,7 +23,10 @@ namespace skydiveLogs_api.Controllers
#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}")]
[EnableCors]
public void Delete(int id)
@@ -31,17 +34,23 @@ namespace skydiveLogs_api.Controllers
_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]
[EnableCors]
public IEnumerable<GearResp> Get()
{
//var result = _gearService.GetAllGears(ConnectedUser);
var result = _gearService.GetAllGears();
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}")]
[EnableCors]
public GearResp Get(int id)
@@ -50,7 +59,10 @@ namespace skydiveLogs_api.Controllers
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]
[EnableCors]
public void Post([FromBody] GearReq value)
@@ -58,7 +70,11 @@ namespace skydiveLogs_api.Controllers
_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}")]
[EnableCors]
public void Put(int id, [FromBody] GearReq value)
@@ -76,4 +92,4 @@ namespace skydiveLogs_api.Controllers
#endregion Private Fields
}
}
}
@@ -1,10 +1,10 @@
using AutoMapper;
using System.Collections.Generic;
using AutoMapper;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using skydiveLogs_api.DataContract;
using skydiveLogs_api.Domain;
using skydiveLogs_api.DomainBusiness.Interfaces;
using System.Collections.Generic;
namespace skydiveLogs_api.Controllers
{
@@ -23,7 +23,10 @@ namespace skydiveLogs_api.Controllers
#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}")]
[EnableCors]
public void Delete(int id)
@@ -31,7 +34,10 @@ namespace skydiveLogs_api.Controllers
_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]
[EnableCors]
public IEnumerable<ImageResp> Get()
@@ -40,7 +46,11 @@ namespace skydiveLogs_api.Controllers
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}")]
[EnableCors]
public ImageResp Get(int id)
@@ -49,7 +59,10 @@ namespace skydiveLogs_api.Controllers
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]
[EnableCors]
public void Post([FromBody] ImageReq value)
@@ -57,7 +70,11 @@ namespace skydiveLogs_api.Controllers
_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}")]
[EnableCors]
public void Put(int id, [FromBody] ImageReq value)
@@ -74,4 +91,4 @@ namespace skydiveLogs_api.Controllers
#endregion Private Fields
}
}
}
@@ -24,7 +24,10 @@ namespace skydiveLogs_api.Controllers
#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}")]
[EnableCors]
public void Delete(int id)
@@ -32,7 +35,10 @@ namespace skydiveLogs_api.Controllers
_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]
[EnableCors]
public JumpListResp Get()
@@ -47,7 +53,12 @@ namespace skydiveLogs_api.Controllers
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}")]
[EnableCors]
public JumpListResp Get(int beginJumpIndex, int endJumpIndex)
@@ -63,7 +74,11 @@ namespace skydiveLogs_api.Controllers
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}")]
[EnableCors]
public JumpResp Get(int id)
@@ -72,7 +87,10 @@ namespace skydiveLogs_api.Controllers
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]
[EnableCors]
public void Post([FromBody] JumpReq value)
@@ -84,7 +102,11 @@ namespace skydiveLogs_api.Controllers
_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}")]
[EnableCors]
public void Put(int id, [FromBody] JumpReq value)
@@ -101,4 +123,4 @@ namespace skydiveLogs_api.Controllers
#endregion Private Fields
}
}
}
@@ -1,10 +1,10 @@
using AutoMapper;
using System.Collections.Generic;
using AutoMapper;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using skydiveLogs_api.DataContract;
using skydiveLogs_api.Domain;
using skydiveLogs_api.DomainBusiness.Interfaces;
using System.Collections.Generic;
namespace skydiveLogs_api.Controllers
{
@@ -23,7 +23,10 @@ namespace skydiveLogs_api.Controllers
#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}")]
[EnableCors]
public void Delete(int id)
@@ -31,7 +34,10 @@ namespace skydiveLogs_api.Controllers
_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]
[EnableCors]
public IEnumerable<JumpTypeResp> Get()
@@ -39,8 +45,11 @@ namespace skydiveLogs_api.Controllers
var result = _jumpTypeService.GetAllJumpTypes();
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")]
[EnableCors]
public IEnumerable<JumpTypeResp> GetForTunnel()
@@ -49,7 +58,11 @@ namespace skydiveLogs_api.Controllers
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}")]
[EnableCors]
public JumpTypeResp Get(int id)
@@ -58,7 +71,10 @@ namespace skydiveLogs_api.Controllers
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]
[EnableCors]
public void Post([FromBody] JumpTypeReq value)
@@ -66,7 +82,11 @@ namespace skydiveLogs_api.Controllers
_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}")]
[EnableCors]
public void Put(int id, [FromBody] JumpTypeReq value)
@@ -83,4 +103,4 @@ namespace skydiveLogs_api.Controllers
#endregion Private Fields
}
}
}
@@ -22,6 +22,10 @@ namespace skydiveLogs_api.Controllers
#region Public Methods
/// <summary>
/// Retrieves statistics grouped by aircraft.
/// </summary>
/// <returns>A collection of StatisticResp objects containing aircraft statistics.</returns>
[HttpGet("ByAircraft")]
[EnableCors]
public IEnumerable<StatisticResp> ByAircraft()
@@ -31,6 +35,10 @@ namespace skydiveLogs_api.Controllers
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")]
[EnableCors]
public IEnumerable<StatisticResp> ByDz()
@@ -40,6 +48,10 @@ namespace skydiveLogs_api.Controllers
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")]
[EnableCors]
public IEnumerable<StatisticResp> ByGear()
@@ -49,6 +61,10 @@ namespace skydiveLogs_api.Controllers
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")]
[EnableCors]
public IEnumerable<StatisticResp> ByJumpType()
@@ -58,6 +74,10 @@ namespace skydiveLogs_api.Controllers
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")]
[EnableCors]
public IEnumerable<StatisticResp> ByYear()
@@ -67,6 +87,10 @@ namespace skydiveLogs_api.Controllers
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")]
[EnableCors]
public StatisticForLastMonthResp ForLastMonth()
@@ -81,6 +105,10 @@ namespace skydiveLogs_api.Controllers
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")]
[EnableCors]
public StatisticForLastYearResp ForLastYear()
@@ -95,6 +123,10 @@ namespace skydiveLogs_api.Controllers
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")]
[EnableCors]
public IEnumerable<StatisticForChartResp> ByYearByJumpType()
@@ -104,6 +136,9 @@ namespace skydiveLogs_api.Controllers
return _mapper.Map<IEnumerable<StatisticForChartResp>>(result);
}
/// <summary>
/// Resets all statistics to their initial state.
/// </summary>
[HttpGet("Reset")]
[EnableCors]
public void Reset()
@@ -111,6 +146,10 @@ namespace skydiveLogs_api.Controllers
_statsService.Reset();
}
/// <summary>
/// Retrieves a simple summary of all statistics.
/// </summary>
/// <returns>A SimpleSummaryResp object containing the simple summary statistics.</returns>
[HttpGet("Simple")]
[EnableCors]
public SimpleSummaryResp Simple()
@@ -129,4 +168,4 @@ namespace skydiveLogs_api.Controllers
#endregion Private properties
}
}
}
@@ -1,9 +1,9 @@
using AutoMapper;
using System.Collections.Generic;
using AutoMapper;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using skydiveLogs_api.DataContract;
using skydiveLogs_api.DomainBusiness.Interfaces;
using System.Collections.Generic;
namespace skydiveLogs_api.Controllers
{
@@ -22,7 +22,10 @@ namespace skydiveLogs_api.Controllers
#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]
[EnableCors]
public IEnumerable<TunnelResp> Get()
@@ -31,7 +34,11 @@ namespace skydiveLogs_api.Controllers
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}")]
[EnableCors]
public TunnelResp Get(int id)
@@ -49,4 +56,4 @@ namespace skydiveLogs_api.Controllers
#endregion Private Fields
}
}
}
@@ -1,10 +1,10 @@
using AutoMapper;
using System.Collections.Generic;
using AutoMapper;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using skydiveLogs_api.DataContract;
using skydiveLogs_api.Domain;
using skydiveLogs_api.DomainBusiness.Interfaces;
using System.Collections.Generic;
namespace skydiveLogs_api.Controllers
{
@@ -23,7 +23,10 @@ namespace skydiveLogs_api.Controllers
#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]
[EnableCors]
public IEnumerable<TunnelFlightResp> Get()
@@ -32,7 +35,11 @@ namespace skydiveLogs_api.Controllers
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}")]
[EnableCors]
public TunnelFlightResp Get(int id)
@@ -41,7 +48,12 @@ namespace skydiveLogs_api.Controllers
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}")]
[EnableCors]
public IEnumerable<TunnelFlightResp> Get(string beginDate, string endDate)
@@ -50,7 +62,12 @@ namespace skydiveLogs_api.Controllers
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}")]
[EnableCors]
public IEnumerable<StatisticForChartResp> GetGroupByMonth(string beginDate, string endDate)
@@ -59,7 +76,10 @@ namespace skydiveLogs_api.Controllers
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]
[EnableCors]
public void Post([FromBody] TunnelFlightReq value)
@@ -69,7 +89,11 @@ namespace skydiveLogs_api.Controllers
_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}")]
[EnableCors]
public void Put(int id, [FromBody] TunnelFlightReq value)
@@ -77,7 +101,10 @@ namespace skydiveLogs_api.Controllers
_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}")]
[EnableCors]
public void Delete(int id)
@@ -94,4 +121,4 @@ namespace skydiveLogs_api.Controllers
#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.Cors;
using Microsoft.AspNetCore.Mvc;
@@ -8,10 +12,6 @@ using skydiveLogs_api.DataContract;
using skydiveLogs_api.Domain;
using skydiveLogs_api.DomainBusiness.Interfaces;
using skydiveLogs_api.Settings;
using System;
using System.IdentityModel.Tokens.Jwt;
using System.Security.Claims;
using System.Text;
namespace skydiveLogs_api.Controllers
{
@@ -34,7 +34,10 @@ namespace skydiveLogs_api.Controllers
#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")]
[EnableCors]
public IActionResult AlwaysLogin()
@@ -42,7 +45,11 @@ namespace skydiveLogs_api.Controllers
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]
[HttpPost("Authenticate")]
[EnableCors]
@@ -67,7 +74,11 @@ namespace skydiveLogs_api.Controllers
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]
[HttpPost]
[EnableCors]
@@ -135,4 +146,4 @@ namespace skydiveLogs_api.Controllers
#endregion Private Fields
}
}
}
@@ -25,5 +25,7 @@ namespace skydiveLogs_api.DataContract
public DateTime JumpDate { get; set; }
public bool IsSpecial { get; set; }
public string Equipment { get; set; }
}
}
@@ -7,18 +7,29 @@ namespace skydiveLogs_api.DataContract
#region Public Properties
public int AircraftId { get; set; }
public int DeployAltitude { get; set; }
public int DropZoneId { get; set; }
public int ExitAltitude { get; set; }
public int GearId { get; set; }
public int Id { get; set; }
public bool IsSpecial { get; set; }
public DateTime JumpDate { get; set; }
public int JumpTypeId { get; set; }
public string Notes { get; set; }
public bool WithCutaway { get; set; }
public string Equipment { get; set; }
#endregion Public Properties
}
}