mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Add endpoint to retrieve machines by processor.
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
#pragma warning disable CS0618
|
#pragma warning disable CS0618
|
||||||
using Marechai.App.Models;
|
using Marechai.App.Models;
|
||||||
using Marechai.App.ProcessorsByMachine.ByMachine;
|
using Marechai.App.ProcessorsByMachine.ByMachine;
|
||||||
|
using Marechai.App.ProcessorsByMachine.ByProcessor;
|
||||||
using Marechai.App.ProcessorsByMachine.Item;
|
using Marechai.App.ProcessorsByMachine.Item;
|
||||||
using Microsoft.Kiota.Abstractions.Extensions;
|
using Microsoft.Kiota.Abstractions.Extensions;
|
||||||
using Microsoft.Kiota.Abstractions.Serialization;
|
using Microsoft.Kiota.Abstractions.Serialization;
|
||||||
@@ -24,6 +25,11 @@ namespace Marechai.App.ProcessorsByMachine
|
|||||||
{
|
{
|
||||||
get => new global::Marechai.App.ProcessorsByMachine.ByMachine.ByMachineRequestBuilder(PathParameters, RequestAdapter);
|
get => new global::Marechai.App.ProcessorsByMachine.ByMachine.ByMachineRequestBuilder(PathParameters, RequestAdapter);
|
||||||
}
|
}
|
||||||
|
/// <summary>The byProcessor property</summary>
|
||||||
|
public global::Marechai.App.ProcessorsByMachine.ByProcessor.ByProcessorRequestBuilder ByProcessor
|
||||||
|
{
|
||||||
|
get => new global::Marechai.App.ProcessorsByMachine.ByProcessor.ByProcessorRequestBuilder(PathParameters, RequestAdapter);
|
||||||
|
}
|
||||||
/// <summary>Gets an item from the Marechai.App.processorsByMachine.item collection</summary>
|
/// <summary>Gets an item from the Marechai.App.processorsByMachine.item collection</summary>
|
||||||
/// <param name="position">Unique identifier of the item</param>
|
/// <param name="position">Unique identifier of the item</param>
|
||||||
/// <returns>A <see cref="global::Marechai.App.ProcessorsByMachine.Item.ProcessorsByMachineItemRequestBuilder"/></returns>
|
/// <returns>A <see cref="global::Marechai.App.ProcessorsByMachine.Item.ProcessorsByMachineItemRequestBuilder"/></returns>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"descriptionHash": "DFB5AA54CD7E25D4B216D1E48D3E6F12FDC6C02AC848D74CEC21E4377589A73692313690598744726310A7AD334B7C8F9FA68E6E9A475D6B0B368CE907204194",
|
"descriptionHash": "B14C84F1E420D2432A615A20FD21AF1B4E0FD47B34883CFF5B5835650E46FB857B939E239BCAA0E48DDD88FC99AC6976E4263A5DBBCDDBDD7068E6F4A3D7FA74",
|
||||||
"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",
|
||||||
|
|||||||
@@ -59,6 +59,25 @@ public class ProcessorsByMachineController(MarechaiContext context) : Controller
|
|||||||
.ThenBy(p => p.Name)
|
.ThenBy(p => p.Name)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
|
[HttpGet("by-processor/{processorId:int}")]
|
||||||
|
[AllowAnonymous]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
|
public Task<List<ProcessorByMachineDto>> GetByProcessor(int processorId) => context.ProcessorsByMachine
|
||||||
|
.Where(p => p.ProcessorId == processorId)
|
||||||
|
.Select(p => new ProcessorByMachineDto
|
||||||
|
{
|
||||||
|
Id = p.Id,
|
||||||
|
MachineId = p.MachineId,
|
||||||
|
ProcessorId = p.ProcessorId,
|
||||||
|
Name = p.Machine.Name,
|
||||||
|
CompanyName = p.Machine.Company.Name,
|
||||||
|
Speed = p.Speed
|
||||||
|
})
|
||||||
|
.OrderBy(p => p.CompanyName)
|
||||||
|
.ThenBy(p => p.Name)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
[HttpDelete("{id:long}")]
|
[HttpDelete("{id:long}")]
|
||||||
[Authorize(Roles = "Admin,UberAdmin")]
|
[Authorize(Roles = "Admin,UberAdmin")]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
|||||||
Reference in New Issue
Block a user