Browse by Genre/Tag/Person with new metadata system for People (#3835)
Co-authored-by: Stepan Goremykin <s.goremykin@proton.me> Co-authored-by: goremykin <goremukin@gmail.com> Co-authored-by: Christopher <39032787+MrRobotjs@users.noreply.github.com> Co-authored-by: Fesaa <77553571+Fesaa@users.noreply.github.com>
This commit is contained in:
parent
00c4712fc3
commit
c52ed1f65d
147 changed files with 6612 additions and 958 deletions
|
@ -286,7 +286,8 @@ public class AutoMapperProfiles : Profile
|
|||
CreateMap<AppUserBookmark, BookmarkDto>();
|
||||
|
||||
CreateMap<ReadingList, ReadingListDto>()
|
||||
.ForMember(dest => dest.ItemCount, opt => opt.MapFrom(src => src.Items.Count));
|
||||
.ForMember(dest => dest.ItemCount, opt => opt.MapFrom(src => src.Items.Count))
|
||||
.ForMember(dest => dest.OwnerUserName, opt => opt.MapFrom(src => src.AppUser.UserName));
|
||||
CreateMap<ReadingListItem, ReadingListItemDto>();
|
||||
CreateMap<ScrobbleError, ScrobbleErrorDto>();
|
||||
CreateMap<ChapterDto, TachiyomiChapterDto>();
|
||||
|
|
31
API/Helpers/Converters/PersonFilterFieldValueConverter.cs
Normal file
31
API/Helpers/Converters/PersonFilterFieldValueConverter.cs
Normal file
|
@ -0,0 +1,31 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using API.DTOs.Filtering.v2;
|
||||
using API.Entities.Enums;
|
||||
|
||||
namespace API.Helpers.Converters;
|
||||
|
||||
public static class PersonFilterFieldValueConverter
|
||||
{
|
||||
public static object ConvertValue(PersonFilterField field, string value)
|
||||
{
|
||||
return field switch
|
||||
{
|
||||
PersonFilterField.Name => value,
|
||||
PersonFilterField.Role => ParsePersonRoles(value),
|
||||
PersonFilterField.SeriesCount => int.Parse(value),
|
||||
PersonFilterField.ChapterCount => int.Parse(value),
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(field), field, "Field is not supported")
|
||||
};
|
||||
}
|
||||
|
||||
private static IList<PersonRole> ParsePersonRoles(string value)
|
||||
{
|
||||
if (string.IsNullOrEmpty(value)) return [];
|
||||
|
||||
return value.Split(',', StringSplitOptions.RemoveEmptyEntries)
|
||||
.Select(v => Enum.Parse<PersonRole>(v.Trim()))
|
||||
.ToList();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue