mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Fix endpoint that gets resolutions by GPUs.
This commit is contained in:
@@ -279,7 +279,7 @@ namespace Marechai.App
|
|||||||
ApiClientBuilder.RegisterDefaultDeserializer<FormParseNodeFactory>();
|
ApiClientBuilder.RegisterDefaultDeserializer<FormParseNodeFactory>();
|
||||||
if (string.IsNullOrEmpty(RequestAdapter.BaseUrl))
|
if (string.IsNullOrEmpty(RequestAdapter.BaseUrl))
|
||||||
{
|
{
|
||||||
RequestAdapter.BaseUrl = "https://localhost:7163";
|
RequestAdapter.BaseUrl = "http://localhost:5023";
|
||||||
}
|
}
|
||||||
PathParameters.TryAdd("baseurl", RequestAdapter.BaseUrl);
|
PathParameters.TryAdd("baseurl", RequestAdapter.BaseUrl);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ using System;
|
|||||||
namespace Marechai.App.ResolutionsByGpu.Gpus.Item.Resolutions
|
namespace Marechai.App.ResolutionsByGpu.Gpus.Item.Resolutions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Builds and executes requests for operations under \resolutions-by-gpu\gpus\{resolutionId}\resolutions
|
/// Builds and executes requests for operations under \resolutions-by-gpu\gpus\{gpuId}\resolutions
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")]
|
[global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")]
|
||||||
public partial class ResolutionsRequestBuilder : BaseRequestBuilder
|
public partial class ResolutionsRequestBuilder : BaseRequestBuilder
|
||||||
@@ -22,7 +22,7 @@ namespace Marechai.App.ResolutionsByGpu.Gpus.Item.Resolutions
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="pathParameters">Path parameters for the request</param>
|
/// <param name="pathParameters">Path parameters for the request</param>
|
||||||
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
|
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
|
||||||
public ResolutionsRequestBuilder(Dictionary<string, object> pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/resolutions-by-gpu/gpus/{resolutionId}/resolutions", pathParameters)
|
public ResolutionsRequestBuilder(Dictionary<string, object> pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/resolutions-by-gpu/gpus/{gpuId}/resolutions", pathParameters)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -30,7 +30,7 @@ namespace Marechai.App.ResolutionsByGpu.Gpus.Item.Resolutions
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="rawUrl">The raw URL to use for the request builder.</param>
|
/// <param name="rawUrl">The raw URL to use for the request builder.</param>
|
||||||
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
|
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
|
||||||
public ResolutionsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/resolutions-by-gpu/gpus/{resolutionId}/resolutions", rawUrl)
|
public ResolutionsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/resolutions-by-gpu/gpus/{gpuId}/resolutions", rawUrl)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
/// <returns>A List<global::Marechai.App.Models.ResolutionByGpuDto></returns>
|
/// <returns>A List<global::Marechai.App.Models.ResolutionByGpuDto></returns>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"descriptionHash": "ABDC74AB94257D5ED6BFBA4E57134BD2B3A4A2C3EC8EC2A514A70334900294CA4391DB5F7404A6055B8B63D0392BB28073F071E07F310F4E650779D5805ACBFF",
|
"descriptionHash": "DFB5AA54CD7E25D4B216D1E48D3E6F12FDC6C02AC848D74CEC21E4377589A73692313690598744726310A7AD334B7C8F9FA68E6E9A475D6B0B368CE907204194",
|
||||||
"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",
|
||||||
|
|||||||
@@ -40,39 +40,36 @@ namespace Marechai.Server.Controllers;
|
|||||||
[ApiController]
|
[ApiController]
|
||||||
public class ResolutionsByGpuController(MarechaiContext context) : ControllerBase
|
public class ResolutionsByGpuController(MarechaiContext context) : ControllerBase
|
||||||
{
|
{
|
||||||
[HttpGet("gpus/{resolutionId:int}/resolutions")]
|
[HttpGet("gpus/{gpuId:int}/resolutions")]
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
public async Task<List<ResolutionByGpuDto>> GetByGpu(int resolutionId) => (await context.ResolutionsByGpu
|
public async Task<List<ResolutionByGpuDto>> GetByGpu(int gpuId) => (await context.ResolutionsByGpu
|
||||||
.Where(r => r.ResolutionId ==
|
.Where(r => r.GpuId == gpuId)
|
||||||
resolutionId)
|
.Select(r => new ResolutionByGpuDto
|
||||||
.Select(r => new ResolutionByGpuDto
|
{
|
||||||
{
|
Id = r.Id,
|
||||||
Id = r.Id,
|
GpuId = r.GpuId,
|
||||||
GpuId = r.GpuId,
|
Resolution = new ResolutionDto
|
||||||
Resolution = new ResolutionDto
|
{
|
||||||
{
|
Id = r.Resolution.Id,
|
||||||
Id = r.Resolution.Id,
|
Width = r.Resolution.Width,
|
||||||
Width = r.Resolution.Width,
|
Height = r.Resolution.Height,
|
||||||
Height = r.Resolution.Height,
|
Colors = r.Resolution.Colors,
|
||||||
Colors = r.Resolution.Colors,
|
Palette = r.Resolution.Palette,
|
||||||
Palette = r.Resolution
|
Chars = r.Resolution.Chars,
|
||||||
.Palette,
|
Grayscale = r.Resolution.Grayscale
|
||||||
Chars = r.Resolution.Chars,
|
},
|
||||||
Grayscale = r.Resolution
|
ResolutionId = r.ResolutionId
|
||||||
.Grayscale
|
})
|
||||||
},
|
.ToListAsync())
|
||||||
ResolutionId = r.ResolutionId
|
.OrderBy(r => r.Resolution.Width)
|
||||||
})
|
.ThenBy(r => r.Resolution.Height)
|
||||||
.ToListAsync())
|
.ThenBy(r => r.Resolution.Chars)
|
||||||
.OrderBy(r => r.Resolution.Width)
|
.ThenBy(r => r.Resolution.Grayscale)
|
||||||
.ThenBy(r => r.Resolution.Height)
|
.ThenBy(r => r.Resolution.Colors)
|
||||||
.ThenBy(r => r.Resolution.Chars)
|
.ThenBy(r => r.Resolution.Palette)
|
||||||
.ThenBy(r => r.Resolution.Grayscale)
|
.ToList();
|
||||||
.ThenBy(r => r.Resolution.Colors)
|
|
||||||
.ThenBy(r => r.Resolution.Palette)
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
[HttpDelete("{id:long}")]
|
[HttpDelete("{id:long}")]
|
||||||
[Authorize(Roles = "Admin,UberAdmin")]
|
[Authorize(Roles = "Admin,UberAdmin")]
|
||||||
|
|||||||
Reference in New Issue
Block a user