Updaed event logic and event creation system

This commit is contained in:
2025-11-30 20:14:08 +01:00
parent 5d1fc1f347
commit 8d0573eb7e
18 changed files with 122 additions and 528 deletions

View File

@@ -1,3 +1,4 @@
using HopFrame.Core.Callbacks;
using HopFrame.Core.Services;
using HopFrame.Web;
using Microsoft.EntityFrameworkCore;
@@ -14,6 +15,9 @@ builder.Services.AddRazorComponents()
builder.AddServiceDefaults();
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true);
builder.Services.AddHttpContextAccessor();
builder.Services.AddScoped<ClientSideStorage>();
builder.AddNpgsqlDbContext<DatabaseContext>("SpotiParty");
@@ -23,6 +27,8 @@ builder.Services.AddDbContextFactory<DatabaseContext>(options => {
builder.Services.AddScoped<AuthorizationHandler>();
builder.Services.AddScoped<IHopFrameAuthHandler, DashboardAuthHandler>();
builder.Services.AddScoped<DashboardAuthHandler>();
builder.Services.AddScoped<EventsDashboardRepo>();
builder.Services.AddHopFrame(config => {
config.SetLoginPage("/login");
@@ -42,12 +48,29 @@ builder.Services.AddHopFrame(config => {
table.ShowSearchSuggestions(false);
});
context.Table<Event>(table => {
table.Property(e => e.Id)
.List(false)
.SetEditable(false);
context.Table<Event>()
.Ignore(true);
});
table.ShowSearchSuggestions(false);
config.AddCustomRepository<EventsDashboardRepo, Event, Guid>(e => e.Id, table => {
//table.SetDisplayName("Events");
table.Property(e => e.Id)
.List(false)
.SetEditable(false)
.SetCreatable(false);
table.Property(e => e.Host)
.SetEditable(false)
.SetCreatable(false)
.SetDisplayedProperty(u => u.DisplayName);
table.ShowSearchSuggestions(false);
table.AddCallbackHandler(CallbackType.CreateEntry, async (entry, services) => {
var auth = services.GetRequiredService<DashboardAuthHandler>();
var user = await auth.GetCurrentUser();
entry.Host = user!;
});
});
});