Doxy, -Wall -Werror, other cleanup and organization first round

This commit is contained in:
2023-08-19 20:46:31 -04:00
parent 1fedd4d016
commit 49de8aa8d7
43 changed files with 728 additions and 354 deletions

View File

@ -7,34 +7,43 @@
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using Swashbuckle.AspNetCore.SwaggerGen;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
using AutoMapper;
using IO.Swagger.Attributes;
using IO.Swagger.Models.RequestDto;
using IO.Swagger.Models.ResponseDto;
using IO.Swagger.Repositories;
using IO.Swagger.Security;
using Microsoft.AspNetCore.Authorization;
using IO.Swagger.Models.dto;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using IO.Swagger.Repositories;
using AutoMapper;
namespace IO.Swagger.Controllers
{
/// <summary>
///
/// </summary>
/// <seealso cref="Microsoft.AspNetCore.Mvc.ControllerBase" />
[ApiController]
public class CurrencyApiController : ControllerBase
{
private readonly ICurrencyRepository repo;
private readonly IMapper mapper;
/// <summary>
/// Initializes a new instance of the <see cref="CurrencyApiController"/> class.
/// </summary>
/// <param name="repo">The repo.</param>
/// <param name="mapper">The mapper.</param>
/// <exception cref="System.ArgumentNullException">
/// repo
/// or
/// mapper
/// </exception>
public CurrencyApiController(ICurrencyRepository repo, IMapper mapper)
{
this.repo = repo ?? throw new ArgumentNullException(nameof(repo));
@ -53,8 +62,8 @@ namespace IO.Swagger.Controllers
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("AddDigitalAssetToCollection")]
public virtual IActionResult AddDigitalAssetToCollection([FromBody]CurrencyAddAssetBody body)
{
public virtual IActionResult AddDigitalAssetToCollection([FromBody] CurrencyAddAssetBody body)
{
//TODO: Uncomment the next line to return response 201 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(201);
@ -79,8 +88,8 @@ namespace IO.Swagger.Controllers
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("CreateAssetCollection")]
public virtual IActionResult CreateAssetCollection([FromBody]CurrencyCreateCollectionBody body)
{
public virtual IActionResult CreateAssetCollection([FromBody] CurrencyCreateCollectionBody body)
{
//TODO: Uncomment the next line to return response 201 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(201);
@ -96,7 +105,7 @@ namespace IO.Swagger.Controllers
/// <summary>
/// Create a new currency type
/// </summary>
/// <param name="body"></param>
/// <param name="body">The currency to create</param>
/// <response code="201">Currency type created successfully</response>
/// <response code="400">Bad Request</response>
/// <response code="401">Unauthorized</response>
@ -107,7 +116,7 @@ namespace IO.Swagger.Controllers
[ValidateModelState]
[SwaggerOperation("CreateCurrency")]
[ProducesResponseType(typeof(IEnumerable<string>), 400)]
public virtual async Task<IActionResult> CreateCurrency([FromBody]CurrencyCreateBody body)
public virtual async Task<IActionResult> CreateCurrency([FromBody] CurrencyCreateBody body)
{
var userIdString = HttpContext.User.Claims.First(c => c.Type == ClaimTypes.NameIdentifier).Value;
if (!int.TryParse(userIdString, out int userId))
@ -123,7 +132,7 @@ namespace IO.Swagger.Controllers
/// <summary>
/// Mint additional units of a currency
/// </summary>
/// <param name="body"></param>
/// <param name="body">The information on the currency to mint</param>
/// <response code="200">Successful minting</response>
/// <response code="400">Bad Request</response>
/// <response code="401">Unauthorized</response>
@ -134,7 +143,7 @@ namespace IO.Swagger.Controllers
[ValidateModelState]
[SwaggerOperation("MintCurrency")]
[ProducesResponseType(typeof(IEnumerable<string>), 400)]
public virtual async Task<IActionResult> MintCurrency([FromBody]CurrencyMintBody body)
public virtual async Task<IActionResult> MintCurrency([FromBody] CurrencyMintBody body)
{
var userIdString = HttpContext.User.Claims.First(c => c.Type == ClaimTypes.NameIdentifier).Value;
if (!int.TryParse(userIdString, out int userId))
@ -151,7 +160,7 @@ namespace IO.Swagger.Controllers
/// </summary>
/// <response code="200">Returns all known currencies</response>
/// <response code="401">Unauthorized</response>
[HttpPost]
[HttpGet]
[Route("/v1/api/currency/getAll")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]