fixes and tweaks

This commit is contained in:
moarten
2026-04-29 20:36:08 +02:00
parent b71f45e76c
commit 385119bb27
58 changed files with 1512 additions and 350 deletions
@@ -3,29 +3,28 @@ using Lutra.Application.Interfaces;
using Lutra.Application.Models.Supermarkten;
using Microsoft.EntityFrameworkCore;
namespace Lutra.Application.Supermarkten
{
public sealed partial class GetSupermarkten
{
public sealed class Handler(ILutraDbContext context) : IQueryHandler<Query, Response>
{
public async Task<Response> Handle(Query request, CancellationToken cancellationToken)
{
var supermarkten = await context.Supermarkten
.AsNoTracking()
.Where(w => w.DeletedAt == null)
.OrderBy(s => s.Naam)
.Skip(request.Skip)
.Take(request.Take)
.Select(s => new Supermarkt
{
Id = s.Id,
Naam = s.Naam
})
.ToListAsync(cancellationToken);
namespace Lutra.Application.Supermarkten;
return new Response { Supermarkten = supermarkten };
}
public sealed partial class GetSupermarkten
{
public sealed class Handler(ILutraDbContext context) : IQueryHandler<Query, Response>
{
public async Task<Response> Handle(Query request, CancellationToken cancellationToken)
{
var supermarkten = await context.Supermarkten
.AsNoTracking()
.Where(w => w.DeletedAt == null)
.OrderBy(s => s.Naam)
.Skip(request.Skip)
.Take(request.Take)
.Select(s => new Supermarkt
{
Id = s.Id,
Naam = s.Naam
})
.ToListAsync(cancellationToken);
return new Response { Supermarkten = supermarkten };
}
}
}
@@ -1,9 +1,8 @@
using Cortex.Mediator.Queries;
namespace Lutra.Application.Supermarkten
namespace Lutra.Application.Supermarkten;
public sealed partial class GetSupermarkten
{
public sealed partial class GetSupermarkten
{
public record Query(int Skip, int Take) : IQuery<Response>;
}
public record Query(int Skip, int Take) : IQuery<Response>;
}
@@ -1,12 +1,11 @@
using Lutra.Application.Models.Supermarkten;
namespace Lutra.Application.Supermarkten
namespace Lutra.Application.Supermarkten;
public sealed partial class GetSupermarkten
{
public sealed partial class GetSupermarkten
public sealed record Response
{
public sealed class Response
{
public required IEnumerable<Supermarkt> Supermarkten { get; set; }
}
public required IEnumerable<Supermarkt> Supermarkten { get; init; }
}
}
@@ -1,4 +1,3 @@
namespace Lutra.Application.Supermarkten
{
public sealed partial class GetSupermarkten { }
}
namespace Lutra.Application.Supermarkten;
public sealed partial class GetSupermarkten { }