Test updates by AI

This commit is contained in:
2026-03-24 22:11:58 +01:00
parent 0ebdbca549
commit 8f0cb650c7
11 changed files with 708 additions and 44 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
{
@@ -101,4 +101,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
{
@@ -76,4 +76,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
{
@@ -74,4 +74,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
{
@@ -39,7 +39,7 @@ namespace skydiveLogs_api.Controllers
var result = _jumpTypeService.GetAllJumpTypes();
return _mapper.Map<IEnumerable<JumpTypeResp>>(result);
}
// GET: api/JumpType/tunnel
[HttpGet("tunnel")]
[EnableCors]
@@ -83,4 +83,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
{
@@ -49,4 +49,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
{
@@ -94,4 +94,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
}
}
}