mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
misc renames
This commit is contained in:
parent
185e37863f
commit
a3cb9fc0a5
5 changed files with 17 additions and 17 deletions
|
|
@ -1,6 +1,6 @@
|
|||
namespace FilterLists.Agent.Core.Urls
|
||||
{
|
||||
public enum FilterListsEntity
|
||||
public enum Entity
|
||||
{
|
||||
License,
|
||||
FilterList,
|
||||
|
|
@ -8,19 +8,19 @@ namespace FilterLists.Agent.Core.Urls
|
|||
{
|
||||
public class EntityUrl
|
||||
{
|
||||
public EntityUrl(FilterListsEntity filterListsEntity, int id, Uri viewUrl)
|
||||
public EntityUrl(Entity entity, int id, Uri url)
|
||||
{
|
||||
FilterListsEntity = filterListsEntity;
|
||||
Entity = entity;
|
||||
Id = id;
|
||||
ViewUrl = viewUrl;
|
||||
Url = url;
|
||||
}
|
||||
|
||||
public FilterListsEntity FilterListsEntity { get; }
|
||||
public Entity Entity { get; }
|
||||
|
||||
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||
public int Id { [UsedImplicitly] get; }
|
||||
|
||||
public Uri ViewUrl { get; }
|
||||
public Uri Url { get; }
|
||||
|
||||
public List<string> ValidationMessages { get; } = new List<string>();
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ protected override string Handle(Command request)
|
|||
{
|
||||
var body = new StringBuilder();
|
||||
body.Append(IssueHeader);
|
||||
var entityInvalidUrlGroups = request.InvalidEntityUrls.GroupBy(i => i.FilterListsEntity);
|
||||
var entityInvalidUrlGroups = request.InvalidEntityUrls.GroupBy(i => i.Entity);
|
||||
foreach (var entityInvalidUrls in entityInvalidUrlGroups)
|
||||
{
|
||||
body.Append(
|
||||
|
|
@ -36,7 +36,7 @@ protected override string Handle(Command request)
|
|||
foreach (var invalidUrl in entityInvalidUrls)
|
||||
{
|
||||
body.Append(
|
||||
$"<li><a href=\"{invalidUrl.ViewUrl.OriginalString}\">{invalidUrl.ViewUrl.OriginalString}</a>");
|
||||
$"<li><a href=\"{invalidUrl.Url.OriginalString}\">{invalidUrl.Url.OriginalString}</a>");
|
||||
body.Append("<ul>");
|
||||
foreach (var message in invalidUrl.ValidationMessages)
|
||||
body.Append($"<li>{message}</li>");
|
||||
|
|
|
|||
|
|
@ -13,14 +13,14 @@ namespace FilterLists.Agent.Infrastructure.FilterListsApi
|
|||
[UsedImplicitly]
|
||||
public class EntityUrlRepository : IEntityUrlRepository
|
||||
{
|
||||
private static readonly Dictionary<string, (string, FilterListsEntity)> EndpointAndEntityByDto =
|
||||
new Dictionary<string, (string, FilterListsEntity)>
|
||||
private static readonly Dictionary<string, (string, Entity)> EndpointAndEntityByDto =
|
||||
new Dictionary<string, (string, Entity)>
|
||||
{
|
||||
{nameof(LicenseUrls), ("licenses", FilterListsEntity.License)},
|
||||
{nameof(ListUrls), ("lists", FilterListsEntity.FilterList)},
|
||||
{nameof(MaintainerUrls), ("maintainers", FilterListsEntity.Maintainer)},
|
||||
{nameof(SoftwareUrls), ("software", FilterListsEntity.Software)},
|
||||
{nameof(SyntaxUrls), ("syntaxes", FilterListsEntity.Syntax)}
|
||||
{nameof(LicenseUrls), ("licenses", Entity.License)},
|
||||
{nameof(ListUrls), ("lists", Entity.FilterList)},
|
||||
{nameof(MaintainerUrls), ("maintainers", Entity.Maintainer)},
|
||||
{nameof(SoftwareUrls), ("software", Entity.Software)},
|
||||
{nameof(SyntaxUrls), ("syntaxes", Entity.Syntax)}
|
||||
};
|
||||
|
||||
private readonly IFilterListsApiClient _apiClient;
|
||||
|
|
@ -51,7 +51,7 @@ private async Task<IEnumerable<EntityUrl>> GetAllForEntity<TModel>(CancellationT
|
|||
var id = (int)propertyInfos.First(p => p.Name == nameof(LicenseUrls.Id)).GetValue(e);
|
||||
return propertyInfos.Where(p => p.GetValue(e) != null && p.PropertyType == typeof(Uri)).Select(p =>
|
||||
new EntityUrl(EndpointAndEntityByDto[typeof(TModel).Name].Item2, id, (Uri)p.GetValue(e)));
|
||||
}).GroupBy(e => e.ViewUrl).Select(e => e.First());
|
||||
}).GroupBy(e => e.Url).Select(e => e.First());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -28,7 +28,7 @@ public UrlValidator(HttpClient httpClient, ILogger<UrlValidator> logger)
|
|||
|
||||
public async Task<EntityUrl> ValidateAsync(EntityUrl entityUrl, CancellationToken cancellationToken)
|
||||
{
|
||||
var url = entityUrl.ViewUrl;
|
||||
var url = entityUrl.Url;
|
||||
try
|
||||
{
|
||||
using var response =
|
||||
|
|
|
|||
Loading…
Reference in a new issue