Esempio n. 1
0
        /// <summary>
        /// The handle to get requested albums
        /// </summary>
        /// <param name="request">The request with filter and pagination params</param>
        /// <param name="cancellationToken">The cancellation token</param>
        /// <returns>The task with the requested albums</returns>
        public async Task <PaginatedQueryResult <GetPaginatedAlbumsQueryResult> > Handle(GetPaginatedAlbumsQuery request, CancellationToken cancellationToken)
        {
            var offset = (request.Skip * request.Take) + 1;
            var albums = await spotifyService.GetAlbumsAsync(request.Genre, request.Take, offset);

            cancellationToken.ThrowIfCancellationRequested();

            if (albums == null)
            {
                return(default);