Create service to populate Imdb data collection within mongo

We can use this collection as an alternative source to lookup imdb ids, which would be executed before name_to_imdb is called in the consumer.
This commit is contained in:
iPromKnight
2024-02-27 22:38:10 +00:00
parent aad59c31e4
commit 79d0ef7f4d
26 changed files with 611 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
namespace Metadata.Extensions;
public static class ServiceCollectionExtensions
{
internal static IServiceCollection AddHttpClients(this IServiceCollection services)
{
services.AddHttpClient(HttpClients.ImdbDataClientName, client => client.BaseAddress = new(HttpClients.ImdbClientBaseAddress));
return services;
}
internal static IServiceCollection AddMongoDb(this IServiceCollection services)
{
services.LoadConfigurationFromEnv<MongoConfiguration>();
services.AddTransient<ImdbMongoDbService>();
return services;
}
internal static IServiceCollection AddJobSupport(this IServiceCollection services)
{
services.LoadConfigurationFromEnv<JobConfiguration>();
services.AddScheduler()
.AddTransient<DownloadImdbDataJob>()
.AddHostedService<JobScheduler>();
return services;
}
}