mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Fix routes.
This commit is contained in:
@@ -3,12 +3,9 @@
|
|||||||
using Marechai.App.Auth;
|
using Marechai.App.Auth;
|
||||||
using Marechai.App.Books;
|
using Marechai.App.Books;
|
||||||
using Marechai.App.BrowserTests;
|
using Marechai.App.BrowserTests;
|
||||||
using Marechai.App.ByLetter;
|
|
||||||
using Marechai.App.ByYear;
|
|
||||||
using Marechai.App.Companies;
|
using Marechai.App.Companies;
|
||||||
using Marechai.App.Computers;
|
using Marechai.App.Computers;
|
||||||
using Marechai.App.Consoles;
|
using Marechai.App.Consoles;
|
||||||
using Marechai.App.Count;
|
|
||||||
using Marechai.App.Countries;
|
using Marechai.App.Countries;
|
||||||
using Marechai.App.Currencies;
|
using Marechai.App.Currencies;
|
||||||
using Marechai.App.Documents;
|
using Marechai.App.Documents;
|
||||||
@@ -25,10 +22,8 @@ using Marechai.App.Machines;
|
|||||||
using Marechai.App.Magazines;
|
using Marechai.App.Magazines;
|
||||||
using Marechai.App.MagazinesByMachine;
|
using Marechai.App.MagazinesByMachine;
|
||||||
using Marechai.App.MagazinesByMachineFamily;
|
using Marechai.App.MagazinesByMachineFamily;
|
||||||
using Marechai.App.MaximumYear;
|
|
||||||
using Marechai.App.Medias;
|
using Marechai.App.Medias;
|
||||||
using Marechai.App.MemoriesByMachine;
|
using Marechai.App.MemoriesByMachine;
|
||||||
using Marechai.App.MinimumYear;
|
|
||||||
using Marechai.App.News;
|
using Marechai.App.News;
|
||||||
using Marechai.App.People;
|
using Marechai.App.People;
|
||||||
using Marechai.App.PeopleByBook;
|
using Marechai.App.PeopleByBook;
|
||||||
@@ -79,16 +74,6 @@ namespace Marechai.App
|
|||||||
{
|
{
|
||||||
get => new global::Marechai.App.BrowserTests.BrowserTestsRequestBuilder(PathParameters, RequestAdapter);
|
get => new global::Marechai.App.BrowserTests.BrowserTestsRequestBuilder(PathParameters, RequestAdapter);
|
||||||
}
|
}
|
||||||
/// <summary>The byLetter property</summary>
|
|
||||||
public global::Marechai.App.ByLetter.ByLetterRequestBuilder ByLetter
|
|
||||||
{
|
|
||||||
get => new global::Marechai.App.ByLetter.ByLetterRequestBuilder(PathParameters, RequestAdapter);
|
|
||||||
}
|
|
||||||
/// <summary>The byYear property</summary>
|
|
||||||
public global::Marechai.App.ByYear.ByYearRequestBuilder ByYear
|
|
||||||
{
|
|
||||||
get => new global::Marechai.App.ByYear.ByYearRequestBuilder(PathParameters, RequestAdapter);
|
|
||||||
}
|
|
||||||
/// <summary>The companies property</summary>
|
/// <summary>The companies property</summary>
|
||||||
public global::Marechai.App.Companies.CompaniesRequestBuilder Companies
|
public global::Marechai.App.Companies.CompaniesRequestBuilder Companies
|
||||||
{
|
{
|
||||||
@@ -104,11 +89,6 @@ namespace Marechai.App
|
|||||||
{
|
{
|
||||||
get => new global::Marechai.App.Consoles.ConsolesRequestBuilder(PathParameters, RequestAdapter);
|
get => new global::Marechai.App.Consoles.ConsolesRequestBuilder(PathParameters, RequestAdapter);
|
||||||
}
|
}
|
||||||
/// <summary>The count property</summary>
|
|
||||||
public global::Marechai.App.Count.CountRequestBuilder Count
|
|
||||||
{
|
|
||||||
get => new global::Marechai.App.Count.CountRequestBuilder(PathParameters, RequestAdapter);
|
|
||||||
}
|
|
||||||
/// <summary>The countries property</summary>
|
/// <summary>The countries property</summary>
|
||||||
public global::Marechai.App.Countries.CountriesRequestBuilder Countries
|
public global::Marechai.App.Countries.CountriesRequestBuilder Countries
|
||||||
{
|
{
|
||||||
@@ -189,11 +169,6 @@ namespace Marechai.App
|
|||||||
{
|
{
|
||||||
get => new global::Marechai.App.MagazinesByMachineFamily.MagazinesByMachineFamilyRequestBuilder(PathParameters, RequestAdapter);
|
get => new global::Marechai.App.MagazinesByMachineFamily.MagazinesByMachineFamilyRequestBuilder(PathParameters, RequestAdapter);
|
||||||
}
|
}
|
||||||
/// <summary>The maximumYear property</summary>
|
|
||||||
public global::Marechai.App.MaximumYear.MaximumYearRequestBuilder MaximumYear
|
|
||||||
{
|
|
||||||
get => new global::Marechai.App.MaximumYear.MaximumYearRequestBuilder(PathParameters, RequestAdapter);
|
|
||||||
}
|
|
||||||
/// <summary>The medias property</summary>
|
/// <summary>The medias property</summary>
|
||||||
public global::Marechai.App.Medias.MediasRequestBuilder Medias
|
public global::Marechai.App.Medias.MediasRequestBuilder Medias
|
||||||
{
|
{
|
||||||
@@ -204,11 +179,6 @@ namespace Marechai.App
|
|||||||
{
|
{
|
||||||
get => new global::Marechai.App.MemoriesByMachine.MemoriesByMachineRequestBuilder(PathParameters, RequestAdapter);
|
get => new global::Marechai.App.MemoriesByMachine.MemoriesByMachineRequestBuilder(PathParameters, RequestAdapter);
|
||||||
}
|
}
|
||||||
/// <summary>The minimumYear property</summary>
|
|
||||||
public global::Marechai.App.MinimumYear.MinimumYearRequestBuilder MinimumYear
|
|
||||||
{
|
|
||||||
get => new global::Marechai.App.MinimumYear.MinimumYearRequestBuilder(PathParameters, RequestAdapter);
|
|
||||||
}
|
|
||||||
/// <summary>The news property</summary>
|
/// <summary>The news property</summary>
|
||||||
public global::Marechai.App.News.NewsRequestBuilder News
|
public global::Marechai.App.News.NewsRequestBuilder News
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
// <auto-generated/>
|
// <auto-generated/>
|
||||||
#pragma warning disable CS0618
|
#pragma warning disable CS0618
|
||||||
|
using Marechai.App.Computers.ByLetter;
|
||||||
|
using Marechai.App.Computers.ByYear;
|
||||||
|
using Marechai.App.Computers.Count;
|
||||||
|
using Marechai.App.Computers.MaximumYear;
|
||||||
|
using Marechai.App.Computers.MinimumYear;
|
||||||
using Marechai.App.Models;
|
using Marechai.App.Models;
|
||||||
using Microsoft.Kiota.Abstractions.Extensions;
|
using Microsoft.Kiota.Abstractions.Extensions;
|
||||||
using Microsoft.Kiota.Abstractions.Serialization;
|
using Microsoft.Kiota.Abstractions.Serialization;
|
||||||
@@ -17,6 +22,31 @@ namespace Marechai.App.Computers
|
|||||||
[global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")]
|
[global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")]
|
||||||
public partial class ComputersRequestBuilder : BaseRequestBuilder
|
public partial class ComputersRequestBuilder : BaseRequestBuilder
|
||||||
{
|
{
|
||||||
|
/// <summary>The byLetter property</summary>
|
||||||
|
public global::Marechai.App.Computers.ByLetter.ByLetterRequestBuilder ByLetter
|
||||||
|
{
|
||||||
|
get => new global::Marechai.App.Computers.ByLetter.ByLetterRequestBuilder(PathParameters, RequestAdapter);
|
||||||
|
}
|
||||||
|
/// <summary>The byYear property</summary>
|
||||||
|
public global::Marechai.App.Computers.ByYear.ByYearRequestBuilder ByYear
|
||||||
|
{
|
||||||
|
get => new global::Marechai.App.Computers.ByYear.ByYearRequestBuilder(PathParameters, RequestAdapter);
|
||||||
|
}
|
||||||
|
/// <summary>The count property</summary>
|
||||||
|
public global::Marechai.App.Computers.Count.CountRequestBuilder Count
|
||||||
|
{
|
||||||
|
get => new global::Marechai.App.Computers.Count.CountRequestBuilder(PathParameters, RequestAdapter);
|
||||||
|
}
|
||||||
|
/// <summary>The maximumYear property</summary>
|
||||||
|
public global::Marechai.App.Computers.MaximumYear.MaximumYearRequestBuilder MaximumYear
|
||||||
|
{
|
||||||
|
get => new global::Marechai.App.Computers.MaximumYear.MaximumYearRequestBuilder(PathParameters, RequestAdapter);
|
||||||
|
}
|
||||||
|
/// <summary>The minimumYear property</summary>
|
||||||
|
public global::Marechai.App.Computers.MinimumYear.MinimumYearRequestBuilder MinimumYear
|
||||||
|
{
|
||||||
|
get => new global::Marechai.App.Computers.MinimumYear.MinimumYearRequestBuilder(PathParameters, RequestAdapter);
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Instantiates a new <see cref="global::Marechai.App.Computers.ComputersRequestBuilder"/> and sets the default values.
|
/// Instantiates a new <see cref="global::Marechai.App.Computers.ComputersRequestBuilder"/> and sets the default values.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
// <auto-generated/>
|
// <auto-generated/>
|
||||||
#pragma warning disable CS0618
|
#pragma warning disable CS0618
|
||||||
|
using Marechai.App.Consoles.ByLetter;
|
||||||
|
using Marechai.App.Consoles.ByYear;
|
||||||
|
using Marechai.App.Consoles.Count;
|
||||||
|
using Marechai.App.Consoles.MaximumYear;
|
||||||
|
using Marechai.App.Consoles.MinimumYear;
|
||||||
using Marechai.App.Models;
|
using Marechai.App.Models;
|
||||||
using Microsoft.Kiota.Abstractions.Extensions;
|
using Microsoft.Kiota.Abstractions.Extensions;
|
||||||
using Microsoft.Kiota.Abstractions.Serialization;
|
using Microsoft.Kiota.Abstractions.Serialization;
|
||||||
@@ -17,6 +22,31 @@ namespace Marechai.App.Consoles
|
|||||||
[global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")]
|
[global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")]
|
||||||
public partial class ConsolesRequestBuilder : BaseRequestBuilder
|
public partial class ConsolesRequestBuilder : BaseRequestBuilder
|
||||||
{
|
{
|
||||||
|
/// <summary>The byLetter property</summary>
|
||||||
|
public global::Marechai.App.Consoles.ByLetter.ByLetterRequestBuilder ByLetter
|
||||||
|
{
|
||||||
|
get => new global::Marechai.App.Consoles.ByLetter.ByLetterRequestBuilder(PathParameters, RequestAdapter);
|
||||||
|
}
|
||||||
|
/// <summary>The byYear property</summary>
|
||||||
|
public global::Marechai.App.Consoles.ByYear.ByYearRequestBuilder ByYear
|
||||||
|
{
|
||||||
|
get => new global::Marechai.App.Consoles.ByYear.ByYearRequestBuilder(PathParameters, RequestAdapter);
|
||||||
|
}
|
||||||
|
/// <summary>The count property</summary>
|
||||||
|
public global::Marechai.App.Consoles.Count.CountRequestBuilder Count
|
||||||
|
{
|
||||||
|
get => new global::Marechai.App.Consoles.Count.CountRequestBuilder(PathParameters, RequestAdapter);
|
||||||
|
}
|
||||||
|
/// <summary>The maximumYear property</summary>
|
||||||
|
public global::Marechai.App.Consoles.MaximumYear.MaximumYearRequestBuilder MaximumYear
|
||||||
|
{
|
||||||
|
get => new global::Marechai.App.Consoles.MaximumYear.MaximumYearRequestBuilder(PathParameters, RequestAdapter);
|
||||||
|
}
|
||||||
|
/// <summary>The minimumYear property</summary>
|
||||||
|
public global::Marechai.App.Consoles.MinimumYear.MinimumYearRequestBuilder MinimumYear
|
||||||
|
{
|
||||||
|
get => new global::Marechai.App.Consoles.MinimumYear.MinimumYearRequestBuilder(PathParameters, RequestAdapter);
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Instantiates a new <see cref="global::Marechai.App.Consoles.ConsolesRequestBuilder"/> and sets the default values.
|
/// Instantiates a new <see cref="global::Marechai.App.Consoles.ConsolesRequestBuilder"/> and sets the default values.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"descriptionHash": "4C4317F1318B3D4CA2225D2F84196E63FE3991CAA0B4FAC3BDA2432C98D3457223C321CFD97E2BC392D20DCE9E265F204F4B0E90C7FE300BC876152A4FC07520",
|
"descriptionHash": "1CBF8A151B68ADF959BF4CE97533C13CE3C5B8E0425C6F097F0EF8A5308B53C6DA208B6B18CF8A0B949DD033B070BB2A4B530F0F64BBBAA487D86887990865AF",
|
||||||
"descriptionLocation": "http://localhost:5023/openapi/v1.json",
|
"descriptionLocation": "http://localhost:5023/openapi/v1.json",
|
||||||
"lockFileVersion": "1.0.0",
|
"lockFileVersion": "1.0.0",
|
||||||
"kiotaVersion": "1.29.0",
|
"kiotaVersion": "1.29.0",
|
||||||
|
|||||||
121
Marechai.App/Services/ComputersService.cs
Normal file
121
Marechai.App/Services/ComputersService.cs
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.Kiota.Abstractions.Serialization;
|
||||||
|
|
||||||
|
namespace Marechai.App.Services;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Service for fetching and managing computers from the Marechai API
|
||||||
|
/// </summary>
|
||||||
|
public class ComputersService
|
||||||
|
{
|
||||||
|
private readonly ApiClient _apiClient;
|
||||||
|
private readonly ILogger<ComputersService> _logger;
|
||||||
|
|
||||||
|
public ComputersService(ApiClient apiClient, ILogger<ComputersService> logger)
|
||||||
|
{
|
||||||
|
_apiClient = apiClient;
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fetches the total count of computers from the API
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Total number of computers, or 0 if API call fails</returns>
|
||||||
|
public async Task<int> GetComputersCountAsync()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Fetching computers count from API");
|
||||||
|
UntypedNode result = await _apiClient.Computers.Count.GetAsync();
|
||||||
|
|
||||||
|
// Extract integer value from UntypedNode
|
||||||
|
// UntypedNode wraps a JsonElement, we need to parse it
|
||||||
|
int count = ExtractIntFromUntypedNode(result);
|
||||||
|
_logger.LogInformation("Successfully fetched computers count: {Count}", count);
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Error fetching computers count from API");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fetches the minimum year of computers from the API
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Minimum year, or 0 if API call fails</returns>
|
||||||
|
public async Task<int> GetMinimumYearAsync()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Fetching minimum year from API");
|
||||||
|
UntypedNode result = await _apiClient.Computers.MinimumYear.GetAsync();
|
||||||
|
|
||||||
|
// Extract integer value from UntypedNode
|
||||||
|
int year = ExtractIntFromUntypedNode(result);
|
||||||
|
_logger.LogInformation("Successfully fetched minimum year: {Year}", year);
|
||||||
|
|
||||||
|
return year;
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Error fetching minimum year from API");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fetches the maximum year of computers from the API
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Maximum year, or 0 if API call fails</returns>
|
||||||
|
public async Task<int> GetMaximumYearAsync()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Fetching maximum year from API");
|
||||||
|
UntypedNode result = await _apiClient.Computers.MaximumYear.GetAsync();
|
||||||
|
|
||||||
|
// Extract integer value from UntypedNode
|
||||||
|
int year = ExtractIntFromUntypedNode(result);
|
||||||
|
_logger.LogInformation("Successfully fetched maximum year: {Year}", year);
|
||||||
|
|
||||||
|
return year;
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Error fetching maximum year from API");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper method to extract an integer from an UntypedNode
|
||||||
|
/// </summary>
|
||||||
|
private int ExtractIntFromUntypedNode(UntypedNode node)
|
||||||
|
{
|
||||||
|
if(node == null) return 0;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Cast to UntypedInteger to access the Value property
|
||||||
|
if(node is UntypedInteger intNode) return intNode.GetValue();
|
||||||
|
|
||||||
|
// Fallback: try to parse ToString() result
|
||||||
|
var stringValue = node.ToString();
|
||||||
|
|
||||||
|
if(!string.IsNullOrWhiteSpace(stringValue) && int.TryParse(stringValue, out int result)) return result;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -40,13 +40,13 @@ namespace Marechai.Server.Controllers;
|
|||||||
[ApiController]
|
[ApiController]
|
||||||
public class ComputersController(MarechaiContext context) : ControllerBase
|
public class ComputersController(MarechaiContext context) : ControllerBase
|
||||||
{
|
{
|
||||||
[HttpGet("/count")]
|
[HttpGet("count")]
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
public Task<int> GetComputersCountAsync() => context.Machines.CountAsync(c => c.Type == MachineType.Computer);
|
public Task<int> GetComputersCountAsync() => context.Machines.CountAsync(c => c.Type == MachineType.Computer);
|
||||||
|
|
||||||
[HttpGet("/minimum-year")]
|
[HttpGet("minimum-year")]
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
@@ -56,7 +56,7 @@ public class ComputersController(MarechaiContext context) : ControllerBase
|
|||||||
t.Introduced.Value.Year > 1000)
|
t.Introduced.Value.Year > 1000)
|
||||||
.MinAsync(t => t.Introduced.Value.Year);
|
.MinAsync(t => t.Introduced.Value.Year);
|
||||||
|
|
||||||
[HttpGet("/maximum-year")]
|
[HttpGet("maximum-year")]
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
@@ -66,7 +66,7 @@ public class ComputersController(MarechaiContext context) : ControllerBase
|
|||||||
t.Introduced.Value.Year > 1000)
|
t.Introduced.Value.Year > 1000)
|
||||||
.MaxAsync(t => t.Introduced.Value.Year);
|
.MaxAsync(t => t.Introduced.Value.Year);
|
||||||
|
|
||||||
[HttpGet("/by-letter/{c}")]
|
[HttpGet("by-letter/{c}")]
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
@@ -84,7 +84,7 @@ public class ComputersController(MarechaiContext context) : ControllerBase
|
|||||||
})
|
})
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
[HttpGet("/by-year/{year:int}")]
|
[HttpGet("by-year/{year:int}")]
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
|
|||||||
@@ -40,13 +40,13 @@ namespace Marechai.Server.Controllers;
|
|||||||
[ApiController]
|
[ApiController]
|
||||||
public class ConsolesController(MarechaiContext context) : ControllerBase
|
public class ConsolesController(MarechaiContext context) : ControllerBase
|
||||||
{
|
{
|
||||||
[HttpGet("/count")]
|
[HttpGet("count")]
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
public Task<int> GetConsolesCountAsync() => context.Machines.CountAsync(c => c.Type == MachineType.Console);
|
public Task<int> GetConsolesCountAsync() => context.Machines.CountAsync(c => c.Type == MachineType.Console);
|
||||||
|
|
||||||
[HttpGet("/minimum-year")]
|
[HttpGet("minimum-year")]
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
@@ -56,7 +56,7 @@ public class ConsolesController(MarechaiContext context) : ControllerBase
|
|||||||
t.Introduced.Value.Year > 1000)
|
t.Introduced.Value.Year > 1000)
|
||||||
.MinAsync(t => t.Introduced.Value.Year);
|
.MinAsync(t => t.Introduced.Value.Year);
|
||||||
|
|
||||||
[HttpGet("/maximum-year")]
|
[HttpGet("maximum-year")]
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
@@ -66,7 +66,7 @@ public class ConsolesController(MarechaiContext context) : ControllerBase
|
|||||||
t.Introduced.Value.Year > 1000)
|
t.Introduced.Value.Year > 1000)
|
||||||
.MaxAsync(t => t.Introduced.Value.Year);
|
.MaxAsync(t => t.Introduced.Value.Year);
|
||||||
|
|
||||||
[HttpGet("/by-letter/{c}")]
|
[HttpGet("by-letter/{c}")]
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
@@ -84,7 +84,7 @@ public class ConsolesController(MarechaiContext context) : ControllerBase
|
|||||||
})
|
})
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
[HttpGet("/by-year/{year:int}")]
|
[HttpGet("by-year/{year:int}")]
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
|
|||||||
Reference in New Issue
Block a user