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:
Joe Milazzo 2025-06-14 12:14:04 -05:00 committed by GitHub
parent 00c4712fc3
commit c52ed1f65d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
147 changed files with 6612 additions and 958 deletions

View file

@ -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>();

View 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();
}
}