feat: pivot to social media workflow app
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System.Text;
|
||||
using Hutopy.Modules.Identity.Data;
|
||||
using Socialize.Data;
|
||||
using Socialize.Infrastructure.Security;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Authentication.Facebook;
|
||||
using Microsoft.AspNetCore.Authentication.Google;
|
||||
@@ -7,7 +8,7 @@ using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
|
||||
namespace Hutopy;
|
||||
namespace Socialize;
|
||||
|
||||
public static class DependencyInjection
|
||||
{
|
||||
@@ -18,9 +19,10 @@ public static class DependencyInjection
|
||||
services.AddHttpContextAccessor();
|
||||
|
||||
services.AddHealthChecks()
|
||||
.AddDbContextCheck<IdentityDbContext>();
|
||||
.AddDbContextCheck<AppDbContext>();
|
||||
|
||||
services.AddHttpClient();
|
||||
services.AddScoped<AccessScopeService>();
|
||||
|
||||
// Customise default API behaviour
|
||||
services.Configure<ApiBehaviorOptions>(options =>
|
||||
@@ -31,6 +33,27 @@ public static class DependencyInjection
|
||||
return services;
|
||||
}
|
||||
|
||||
public static IServiceCollection AddAppData(
|
||||
this IServiceCollection services,
|
||||
string postgresConnectionString)
|
||||
{
|
||||
services.AddDbContext<AppDbContext>(options =>
|
||||
options.UseNpgsql(postgresConnectionString));
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
public static async Task<IApplicationBuilder> UseAppDataAsync(
|
||||
this IApplicationBuilder app,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
using IServiceScope scope = app.ApplicationServices.CreateScope();
|
||||
await using AppDbContext context = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
await context.Database.EnsureCreatedAsync(cancellationToken);
|
||||
|
||||
return app;
|
||||
}
|
||||
|
||||
public static IServiceCollection AddAuthorizationAndAuthentication(this IServiceCollection services,
|
||||
ConfigurationManager configuration)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user