Refactor all code

This commit is contained in:
2026-05-24 17:22:03 +01:00
parent fe58e5e7e7
commit 656100d15e
117 changed files with 3317 additions and 1562 deletions
@@ -1,9 +1,7 @@
using FastEndpoints;
using PyroFetes.Endpoints.Quotations;
using PyroFetes.Models;
using PyroFetes.Repositories;
using PyroFetes.Specifications.DeliveryNotes;
using PyroFetes.Specifications.Quotations;
namespace PyroFetes.Endpoints.DeliveryNotes;
@@ -17,22 +15,21 @@ public class DeleteDeliveryNoteEndpoint(
{
public override void Configure()
{
Delete("/deliveryNotes/{@Id}", x => new {x.Id});
Delete("/deliveryNotes/{@Id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(DeleteDeliveryNoteRequest req, CancellationToken ct)
{
DeliveryNote? deliveryNote = await deliveryNotesRepository.FirstOrDefaultAsync(new GetDeliveryNoteByIdSpec(req.Id), ct);
DeliveryNote? deliveryNote = await deliveryNotesRepository.SingleOrDefaultAsync(new GetDeliveryNoteByIdSpec(req.Id), ct);
if (deliveryNote == null)
if (deliveryNote is null)
{
await Send.NotFoundAsync(ct);
return;
}
await deliveryNotesRepository.DeleteAsync(deliveryNote, ct);
await Send.NoContentAsync(ct);
}
}