test av integration mot hardcover
This commit is contained in:
@@ -1,10 +1,15 @@
|
||||
using Bibblan.Business.Clients;
|
||||
using Bibblan.Business.Services;
|
||||
using Bibblan.Models;
|
||||
using Bibblan.ViewModels;
|
||||
using Dapper;
|
||||
using GraphQL.Client.Abstractions;
|
||||
using GraphQL.Client.Http;
|
||||
using GraphQL.Client.Serializer.Newtonsoft;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Net.Http;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.Configuration.AddJsonFile($"appsettings.user.json", true, true);
|
||||
@@ -23,7 +28,15 @@ builder.Services.AddControllers();
|
||||
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
|
||||
builder.Services.AddOpenApi();
|
||||
|
||||
//hardcover registration
|
||||
builder.Services.AddTransient<HardcoverAuthenticationHandler>();//m<>ste vara transient
|
||||
builder.Services.AddScoped<IGraphQLClient>(s => new GraphQLHttpClient(new GraphQLHttpClientOptions
|
||||
{
|
||||
HttpMessageHandler = s.GetRequiredService<HardcoverAuthenticationHandler>(),
|
||||
EndPoint = new Uri(config.HardcoverApiUrl),
|
||||
}, new NewtonsoftJsonSerializer()));
|
||||
|
||||
//databases
|
||||
builder.Services.AddDbContext<SqliteCalibreContext>(options => options.UseSqlite($"Data Source={config.CalibreDb};Mode=ReadOnly;"));
|
||||
builder.Services.AddDbContext<PostgresCalibreContext>(options => options.UseNpgsql(config.BibblanConnection));
|
||||
|
||||
|
Reference in New Issue
Block a user