Add shared pagination, projections and ownership helpers; simplify query and command handlers

This commit is contained in:
2026-09-24 11:59:34 +02:00
parent 5a0f82b77b
commit 4b147d9ee3
84 changed files with 547 additions and 767 deletions
@@ -3,6 +3,7 @@ using Mediator;
using Microsoft.EntityFrameworkCore;
using Musify.Application.Contracts;
using Musify.Application.Users.Responses;
using Musify.Application.Shared;
namespace Musify.Application.Users;
@@ -20,9 +21,8 @@ public class GetUserByIdQueryHandler(IDatabase database)
.Select(u => UserApplicationResponse.FromEntity(u))
.SingleOrDefaultAsync(cancellationToken);
if (user == null)
return Error.NotFound();
return user;
return user == null
? AppErrors.NotFound("User", request.Id)
: user;
}
}