This commit is contained in:
2026-07-14 19:11:58 +02:00
parent 126f767dca
commit 84ffb1eef6
4 changed files with 10 additions and 13 deletions
@@ -16,10 +16,10 @@ public sealed class CreateUserRequestValidator : AbstractValidator<CreateUserReq
RuleFor(x => x.FirstName)
.MaximumLength(48)
.When(x => x.FirstName is not null);
.When(x => !string.IsNullOrWhiteSpace(x.FirstName));
RuleFor(x => x.SecondName)
.MaximumLength(48)
.When(x => x.SecondName is not null);
.When(x => !string.IsNullOrWhiteSpace(x.SecondName));
}
}
@@ -16,9 +16,6 @@ namespace Musify.Application.Tracks
{
public async ValueTask<ErrorOr<PaginatedResponse<TrackApplicationResponse> >> Handle(GetTracksQuery request, CancellationToken cancellationToken)
{
var pageNumber = request.PageNumber < 1 ? 1 : request.PageNumber;
var pageSize = request.PageSize < 1 ? 10 : request.PageSize;
var tracksQuery = database.UserHasTracks
.AsNoTracking()
.Include(ut => ut.Track)
@@ -35,7 +32,7 @@ namespace Musify.Application.Tracks
var pagedTracks = await tracksQuery
.OrderBy(t => t.Id)
.Select(t => TrackApplicationResponse.FromEntity(t.Track))
.ToPagedListAsync(pageNumber, pageSize, totalCount, cancellationToken);
.ToPagedListAsync(request.PageNumber, request.PageSize, totalCount, cancellationToken);
return PaginatedResponse<TrackApplicationResponse>.FromPagedList(pagedTracks);
}