Actions initial commit
Some checks failed
Docker Image CI / build (push) Has been cancelled

This commit is contained in:
2025-10-16 02:52:04 +02:00
parent 13fb917c5d
commit 53276e858b
36 changed files with 1013 additions and 169 deletions

View File

@@ -1,5 +1,7 @@
using System.Reflection;
using API;
using API.Schema.ActionsContext;
using API.Schema.ActionsContext.Actions;
using API.Schema.LibraryContext;
using API.Schema.MangaContext;
using API.Schema.NotificationsContext;
@@ -92,6 +94,8 @@ builder.Services.AddDbContext<NotificationsContext>(options =>
options.UseNpgsql(connectionStringBuilder.ConnectionString));
builder.Services.AddDbContext<LibraryContext>(options =>
options.UseNpgsql(connectionStringBuilder.ConnectionString));
builder.Services.AddDbContext<ActionsContext>(options =>
options.UseNpgsql(connectionStringBuilder.ConnectionString));
builder.Services.Configure<Microsoft.AspNetCore.Http.Json.JsonOptions>(options =>
{
@@ -180,6 +184,15 @@ try //Connect to DB and apply migrations
await context.Sync(CancellationToken.None, reason: "Startup library");
}
using (IServiceScope scope = app.Services.CreateScope())
{
ActionsContext context = scope.ServiceProvider.GetRequiredService<ActionsContext>();
await context.Database.MigrateAsync(CancellationToken.None);
context.Actions.Add(new StartupActionRecord());
await context.Sync(CancellationToken.None, reason: "Startup actions");
}
}
catch (Exception e)
{