suppr all 'var' and Models.xxx. And added 's' at the end of all directories endpoints

This commit is contained in:
2025-11-17 20:49:12 +01:00
parent 20bbccf883
commit 6dba61f742
45 changed files with 141 additions and 114 deletions

View File

@@ -0,0 +1,39 @@
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
using PyroFetes.DTO.SettingDTO.Response;
using PyroFetes.Models;
namespace PyroFetes.Endpoints.Settings;
public class GetSettingRequest
{
public int Id { get; set; }
}
public class GetSettingEndpoint(PyroFetesDbContext database) : Endpoint<GetSettingRequest, GetSettingDto>
{
public override void Configure()
{
Get("/api/setting/{@Id}", x => new {x.Id});
}
public override async Task HandleAsync(GetSettingRequest req, CancellationToken ct)
{
Setting? setting = await database.Settings
.SingleOrDefaultAsync(x => x.Id == req.Id, ct);
if (setting == null)
{
await Send.NotFoundAsync(ct);
return;
}
GetSettingDto responseDto = new()
{
Id = setting.Id,
ElectronicSignature = setting.ElectronicSignature,
Logo = setting.Logo
};
await Send.OkAsync(responseDto, ct);
}
}