Adds streaming to GetContents

This commit is contained in:
Jonathan Bourdon
2024-07-17 21:47:31 -04:00
parent 25ea9b50c7
commit bc87331903
12 changed files with 201 additions and 42 deletions

View File

@@ -5,8 +5,9 @@ using Hutopy.Infrastructure;
using Hutopy.Infrastructure.Data;
using Hutopy.Infrastructure.Identity;
using Hutopy.Web;
using Hutopy.Web.Contents;
using Hutopy.Web.Contents.Data;
using Hutopy.Web.Messages.Data;
using Hutopy.Web.Messages;
using Microsoft.AspNetCore.HttpOverrides;
using Microsoft.EntityFrameworkCore;
using NSwag;
@@ -37,7 +38,7 @@ builder.Services.AddCors(options =>
.AllowAnyHeader()
.AllowCredentials();
});
options.AddPolicy("AllowHutopyUiPreview", policy =>
{
policy.WithOrigins("https://zealous-bay-08204590f-preview.eastus2.5.azurestaticapps.net")
@@ -78,20 +79,12 @@ builder.Services.AddOpenApiDocument((configure, sp) =>
configure.OperationProcessors.Add(new AspNetCoreOperationSecurityScopeProcessor("JWT"));
});
builder.Services.AddFastEndpoints();
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection")
?? throw new InvalidOperationException("Missing ConnectionStrings:DefaultConnection");
builder.Services.AddDbContext<MessagingDbContext>((_, options) =>
{
options.UseSqlServer(connectionString);
});
builder.Services.AddDbContext<ContentDbContext>((_, options) =>
{
options.UseSqlServer(connectionString);
});
builder.Services.AddFastEndpoints();
builder.Services.AddContentModule(options => options.UseSqlServer(connectionString));
builder.Services.AddMessagingModule(options => options.UseSqlServer(connectionString));
builder.Services.Configure<JwtOptions>(builder.Configuration.GetRequiredSection(JwtOptions.SectionName));
@@ -109,7 +102,8 @@ app.UseAuthentication();
app.UseAuthorization();
// Initialize and seed the db.
await app.InitialiseDatabaseAsync();
await app.InitialiseApplicationDatabaseAsync();
await app.InitialiseContentDatabaseAsync();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())