mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
parent
62581034b0
commit
9041fc68d2
4 changed files with 48 additions and 29 deletions
|
|
@ -15,9 +15,9 @@ public FilterListService(FilterListsDbContext dbContext, IConfigurationProvider
|
|||
{
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<List>> GetAllAsync() =>
|
||||
public async Task<IEnumerable<FilterListDto>> GetAllAsync() =>
|
||||
await DbContext.FilterLists
|
||||
.ProjectTo<List>(MapConfig)
|
||||
.ProjectTo<FilterListDto>(MapConfig)
|
||||
.ToListAsync();
|
||||
|
||||
public async Task<ListDetails> GetDetailsAsync(int id) =>
|
||||
|
|
|
|||
|
|
@ -7,19 +7,24 @@
|
|||
namespace FilterLists.Services.FilterList.MappingProfiles
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public class ListMappingProfile : Profile
|
||||
public class FilterListDtoMappingProfile : Profile
|
||||
{
|
||||
public ListMappingProfile() =>
|
||||
CreateMap<Data.Entities.FilterList, List>()
|
||||
public FilterListDtoMappingProfile() =>
|
||||
CreateMap<Data.Entities.FilterList, FilterListDto>()
|
||||
.ForMember(dest => dest.Id,
|
||||
opt => opt.MapFrom(src =>
|
||||
(int)src.Id))
|
||||
.ForMember(dest => dest.LanguageIds,
|
||||
opt => opt.MapFrom(src =>
|
||||
src.FilterListLanguages.Select(ll => (int)ll.LanguageId)))
|
||||
src.FilterListLanguages
|
||||
.Select(ll => (int)ll.LanguageId)))
|
||||
.ForMember(dest => dest.LicenseId,
|
||||
opt => opt.MapFrom(src =>
|
||||
(int)src.LicenseId))
|
||||
.ForMember(dest => dest.MaintainerIds,
|
||||
opt => opt.MapFrom(src =>
|
||||
src.FilterListMaintainers.Select(ll => (int)ll.MaintainerId)))
|
||||
src.FilterListMaintainers
|
||||
.Select(ll => (int)ll.MaintainerId)))
|
||||
.ForMember(dest => dest.RuleCount,
|
||||
opt => opt.MapFrom(src =>
|
||||
src.Snapshots
|
||||
|
|
@ -31,7 +36,8 @@ public ListMappingProfile() =>
|
|||
(int)src.SyntaxId))
|
||||
.ForMember(dest => dest.TagIds,
|
||||
opt => opt.MapFrom(src =>
|
||||
src.FilterListTags.Select(lt => (int)lt.TagId)))
|
||||
src.FilterListTags
|
||||
.Select(lt => (int)lt.TagId)))
|
||||
.ForMember(dest => dest.UpdatedDate,
|
||||
opt => opt.MapFrom(src =>
|
||||
src.Snapshots
|
||||
34
src/FilterLists.Services/FilterList/Models/FilterListDto.cs
Normal file
34
src/FilterLists.Services/FilterList/Models/FilterListDto.cs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace FilterLists.Services.FilterList.Models
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public class FilterListDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string ChatUrl { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string DescriptionSourceUrl { get; set; }
|
||||
public DateTime? DiscontinuedDate { get; set; }
|
||||
public string DonateUrl { get; set; }
|
||||
public string EmailAddress { get; set; }
|
||||
public string ForumUrl { get; set; }
|
||||
public string HomeUrl { get; set; }
|
||||
public string IssuesUrl { get; set; }
|
||||
public List<int> LanguageIds { get; set; }
|
||||
public int? LicenseId { get; set; }
|
||||
public List<int> MaintainerIds { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string PolicyUrl { get; set; }
|
||||
public DateTime? PublishedDate { get; set; }
|
||||
public int? RuleCount { get; set; }
|
||||
public string SubmissionUrl { get; set; }
|
||||
public int? SyntaxId { get; set; }
|
||||
public List<int> TagIds { get; set; }
|
||||
public DateTime? UpdatedDate { get; set; }
|
||||
public string ViewUrl { get; set; }
|
||||
public List<string> ViewUrlMirrors { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace FilterLists.Services.FilterList.Models
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public class List
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public List<int> LanguageIds { get; set; }
|
||||
public List<int> MaintainerIds { get; set; }
|
||||
public string Name { get; set; }
|
||||
public int? RuleCount { get; set; }
|
||||
public int? SyntaxId { get; set; }
|
||||
public List<int> TagIds { get; set; }
|
||||
public DateTime? UpdatedDate { get; set; }
|
||||
public string ViewUrl { get; set; }
|
||||
public List<string> ViewUrlMirrors { get; set; }
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue