Code cleanup

This commit is contained in:
Jeff Leung 2024-01-18 19:07:18 -08:00
parent e0189381f1
commit af3cc81180
11 changed files with 25 additions and 33 deletions

View File

@ -1,8 +1,8 @@
using AS1024.GeoFeed.Core.Interfaces;
using AS1024.GeoFeed.Core.Tools;
using AS1024.GeoFeed.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Hosting;
using AS1024.GeoFeed.Core.Tools;
namespace AS1024.GeoFeed.Core.GeoFeedSqliteLocalCache
{

View File

@ -1,8 +1,8 @@
using System.Text;
using AS1024.GeoFeed.Core.Interfaces;
using AS1024.GeoFeed.Core.Interfaces;
using AS1024.GeoFeed.Core.Tools;
using AS1024.GeoFeed.Models;
using Microsoft.Extensions.Caching.Memory;
using System.Text;
namespace AS1024.GeoFeed.Core.WebLogic
{

View File

@ -39,7 +39,7 @@ namespace AS1024.GeoFeed.Core.CacheService
{
var scope = host.Services.CreateScope();
var persistentCacheProvider =
var persistentCacheProvider =
scope.ServiceProvider.GetRequiredService<IGeoFeedPersistentCacheProvider>();
var results = await feedProvider.GetGeoFeedDataAsync();

View File

@ -1,13 +1,7 @@
using AS1024.GeoFeed.Core.Interfaces;
using AS1024.GeoFeed.Models;
using AS1024.GeoFeed.Core.Tools;
using AS1024.GeoFeed.Models;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
namespace AS1024.GeoFeed.Core.CacheService

View File

@ -6,7 +6,7 @@ namespace AS1024.GeoFeed.Core.GeoFeedProviders
{
public class NetBoxGeoFeedProvider : NetBoxGeoFeedProviderBase, IGeoFeedProvider
{
public NetBoxGeoFeedProvider(IConfiguration configuration, ILogger<NetBoxGeoFeedProvider> logger, IHttpClientFactory httpClientFactory)
public NetBoxGeoFeedProvider(IConfiguration configuration, ILogger<NetBoxGeoFeedProvider> logger, IHttpClientFactory httpClientFactory)
: base(configuration, logger, httpClientFactory)
{
}

View File

@ -1,11 +1,11 @@
using AS1024.GeoFeed.Core.Interfaces;
using AS1024.GeoFeed.Models;
using System.Text.Json;
using System.Net.Http.Headers;
using System.Net.Sockets;
using System.Web;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using System.Net.Http.Headers;
using System.Net.Sockets;
using System.Text.Json;
using System.Web;
namespace AS1024.GeoFeed.Core.GeoFeedProviders
{

View File

@ -1,9 +1,4 @@
using AS1024.GeoFeed.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AS1024.GeoFeed.Core.Interfaces
{

View File

@ -19,16 +19,19 @@ namespace AS1024.GeoFeed.MinimalAPI
builder.Services.AddMemoryCache();
builder.Services.AddLogging();
builder.Services.AddHttpClient();
builder.Services.ConfigureHttpJsonOptions(options => {
builder.Services.ConfigureHttpJsonOptions(options =>
{
options.SerializerOptions.TypeInfoResolverChain.Insert(0, AppJsonSerializerContext.Default);
});
var app = builder.Build();
app.Map("/geofeed.csv", async (GeoFeedReturn feedReturn) => {
app.Map("/geofeed.csv", async (GeoFeedReturn feedReturn) =>
{
return await feedReturn.GetGeoFeed();
});
app.Map("/geofeed", async (GeoFeedReturn feedReturn) => {
app.Map("/geofeed", async (GeoFeedReturn feedReturn) =>
{
return await feedReturn.GetGeoFeed();
});

View File

@ -1,11 +1,10 @@
using System.Text.Json.Serialization;
namespace AS1024.GeoFeed.Models
namespace AS1024.GeoFeed.Models
{
public class NetboxData
{
public List<Result>? Results { get; set; }
public string? Next { get; set; }
public string? Previous { get; set; }
public string? Previous { get; set; }
}
public class Result
@ -41,7 +40,8 @@ namespace AS1024.GeoFeed.Models
/// <summary>
/// This class represents the IP GeoFeed Entry
/// </summary>
public class IPGeoFeed : CustomFields {
public class IPGeoFeed : CustomFields
{
/// <summary>
/// Represents the IP Prefix for the associated GeoFeed entry
/// </summary>

View File

@ -1,5 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using AS1024.GeoFeed.Core.WebLogic;
using AS1024.GeoFeed.Core.WebLogic;
using Microsoft.AspNetCore.Mvc;
namespace AS1024.GeoFeed.Controllers
{

View File

@ -1,10 +1,10 @@
using AS1024.GeoFeed.Core.Interfaces;
using AS1024.GeoFeed.Core.CacheService;
using AS1024.GeoFeed.Core.GeoFeedPreloader;
using AS1024.GeoFeed.Core.GeoFeedProviders;
using Microsoft.EntityFrameworkCore;
using AS1024.GeoFeed.Core.GeoFeedSqliteLocalCache;
using AS1024.GeoFeed.Core.CacheService;
using AS1024.GeoFeed.Core.Interfaces;
using AS1024.GeoFeed.Core.WebLogic;
using Microsoft.EntityFrameworkCore;
namespace AS1024.GeoFeed
{