move artificial delay to a different method for now
parent
25774df6f9
commit
675b6792b2
|
@ -28,7 +28,6 @@ public class PodcastDbContext : DbContext
|
||||||
{
|
{
|
||||||
modelBuilder.Entity<Feed>().HasData(Seed.Feeds);
|
modelBuilder.Entity<Feed>().HasData(Seed.Feeds);
|
||||||
modelBuilder.Entity<Category>().HasData(Seed.Categories);
|
modelBuilder.Entity<Category>().HasData(Seed.Categories);
|
||||||
modelBuilder.Entity<Show>().HasQueryFilter(show => _showClient.CheckLink(show.Link).Result);
|
|
||||||
modelBuilder.Entity<FeedCategory>().HasData(Seed.FeedCategories);
|
modelBuilder.Entity<FeedCategory>().HasData(Seed.FeedCategories);
|
||||||
modelBuilder.Entity<FeedCategory>().HasKey(prop => new { prop.FeedId, prop.CategoryId });
|
modelBuilder.Entity<FeedCategory>().HasKey(prop => new { prop.FeedId, prop.CategoryId });
|
||||||
base.OnModelCreating(modelBuilder);
|
base.OnModelCreating(modelBuilder);
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Podcast.API.Models;
|
using Podcast.API.Models;
|
||||||
using Podcast.Infrastructure.Data;
|
using Podcast.Infrastructure.Data;
|
||||||
|
using Podcast.Infrastructure.Http;
|
||||||
|
|
||||||
namespace Podcast.API.Routes;
|
namespace Podcast.API.Routes;
|
||||||
|
|
||||||
|
@ -14,7 +15,7 @@ public static class ShowsApi
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async ValueTask<Ok<List<ShowDto>>> GetAllShows(int limit, string? term, Guid? categoryId, CancellationToken cancellationToken, PodcastDbContext podcastDbContext)
|
public static async ValueTask<Ok<List<ShowDto>>> GetAllShows(int limit, string? term, Guid? categoryId, CancellationToken cancellationToken, PodcastDbContext podcastDbContext, ShowClient showClient)
|
||||||
{
|
{
|
||||||
var showsQuery = podcastDbContext.Shows.Include(show => show.Feed!.Categories)
|
var showsQuery = podcastDbContext.Shows.Include(show => show.Feed!.Categories)
|
||||||
.ThenInclude(x => x.Category)
|
.ThenInclude(x => x.Category)
|
||||||
|
@ -32,7 +33,9 @@ public static class ShowsApi
|
||||||
.Take(limit)
|
.Take(limit)
|
||||||
.Select(x => new ShowDto(x))
|
.Select(x => new ShowDto(x))
|
||||||
.ToListAsync(cancellationToken);
|
.ToListAsync(cancellationToken);
|
||||||
return TypedResults.Ok(shows);
|
var showsWithValidLinks =
|
||||||
|
shows.Where(show => !showClient.CheckLink(show.Link).Result).ToList();
|
||||||
|
return TypedResults.Ok(showsWithValidLinks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue