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
@@ -10,26 +10,27 @@ public class GetDeliveryNoteRequest
{
public int DeliveryNoteId { get; set; }
}
public class GetDeliveryNoteEndpoint(
DeliveryNotesRepository deliveryNotesRepository,
AutoMapper.IMapper mapper) : Endpoint<GetDeliveryNoteRequest, GetDeliveryNoteDto>
{
public override void Configure()
{
Get("/deliveryNotes/{@id}", x=> new {x.DeliveryNoteId});
Get("/deliveryNotes/{@Id}", x => new { x.DeliveryNoteId });
AllowAnonymous();
}
public override async Task HandleAsync(GetDeliveryNoteRequest req, CancellationToken ct)
{
DeliveryNote? deliveryNote = await deliveryNotesRepository.FirstOrDefaultAsync(new GetDeliveryNoteByIdSpec(req.DeliveryNoteId), ct);
DeliveryNote? deliveryNote = await deliveryNotesRepository.SingleOrDefaultAsync(new GetDeliveryNoteByIdSpec(req.DeliveryNoteId), ct);
if (deliveryNote == null)
if (deliveryNote is null)
{
await Send.NotFoundAsync(ct);
return;
}
await Send.OkAsync(mapper.Map<GetDeliveryNoteDto>(deliveryNote), ct);
}
}