Added NoContent responses when APIs don't find entities (#2028)
This commit is contained in:
parent
2e5e114970
commit
3a7e3bea8c
4 changed files with 19 additions and 20 deletions
|
@ -80,7 +80,7 @@ public interface ISeriesRepository
|
|||
/// <returns></returns>
|
||||
Task<SearchResultGroupDto> SearchSeries(int userId, bool isAdmin, IList<int> libraryIds, string searchQuery);
|
||||
Task<IEnumerable<Series>> GetSeriesForLibraryIdAsync(int libraryId, SeriesIncludes includes = SeriesIncludes.None);
|
||||
Task<SeriesDto> GetSeriesDtoByIdAsync(int seriesId, int userId);
|
||||
Task<SeriesDto?> GetSeriesDtoByIdAsync(int seriesId, int userId);
|
||||
Task<Series?> GetSeriesByIdAsync(int seriesId, SeriesIncludes includes = SeriesIncludes.Volumes | SeriesIncludes.Metadata);
|
||||
Task<IList<Series>> GetSeriesByIdsAsync(IList<int> seriesIds);
|
||||
Task<int[]> GetChapterIdsForSeriesAsync(IList<int> seriesIds);
|
||||
|
@ -442,11 +442,13 @@ public class SeriesRepository : ISeriesRepository
|
|||
return result;
|
||||
}
|
||||
|
||||
public async Task<SeriesDto> GetSeriesDtoByIdAsync(int seriesId, int userId)
|
||||
public async Task<SeriesDto?> GetSeriesDtoByIdAsync(int seriesId, int userId)
|
||||
{
|
||||
var series = await _context.Series.Where(x => x.Id == seriesId)
|
||||
.ProjectTo<SeriesDto>(_mapper.ConfigurationProvider)
|
||||
.SingleAsync();
|
||||
.SingleOrDefaultAsync();
|
||||
|
||||
if (series == null) return null;
|
||||
|
||||
var seriesList = new List<SeriesDto>() {series};
|
||||
await AddSeriesModifiers(userId, seriesList);
|
||||
|
|
|
@ -9,6 +9,7 @@ using API.Extensions;
|
|||
using API.Services;
|
||||
using AutoMapper;
|
||||
using AutoMapper.QueryableExtensions;
|
||||
using Kavita.Common;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace API.Data.Repositories;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue