Add Settings, Account, Bug Reports, and Leaderboard
Server: - New SOR.Support project: SubmitBugReport, GetLeaderboard, GetAccountProfile handlers - New SOR.Database support schema: BugReport + BugReportResponse entities + SupportDbContext - EF migration: Migrations/Support/AddSupport - Admin panel: Bug Reports list + detail pages with reply-to-submitter flow - Admin NavMenu: Support section with Bug Reports link - Reply creates chat.Notification (type "admin_response") for in-game mailbox Client: - Settings autoload (Settings.gd): music/sfx volume+mute, persisted to user://settings.cfg - SettingsScreen: sliders + mute CheckButtons wired to Settings autoload - AccountScreen: profile (display name, OP, rank score) + mailbox (admin_response notifications) - LeaderboardScreen: paginated ranked player list, caller highlighted in blue - BugReportDialog: category/title/description/steps form, submits via support.submit_bug_report - MainScreen: new Leaderboard, Account, Settings, Report a Bug navigation buttons Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
namespace SOR.Database.Contexts;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using SOR.Database.Entities.Support;
|
||||
|
||||
/// <summary>
|
||||
/// EF Core DbContext for the support schema (bug reports).
|
||||
///
|
||||
/// Schema: "support"
|
||||
/// Run migrations:
|
||||
/// dotnet ef migrations add InitialCreate
|
||||
/// --context SupportDbContext
|
||||
/// --project src/SOR.Database
|
||||
/// --startup-project src/SOR.Admin
|
||||
/// --output-dir Migrations/Support
|
||||
/// </summary>
|
||||
public sealed class SupportDbContext : DbContext
|
||||
{
|
||||
public SupportDbContext(DbContextOptions<SupportDbContext> options)
|
||||
: base(options) { }
|
||||
|
||||
public DbSet<BugReport> BugReports => Set<BugReport>();
|
||||
public DbSet<BugReportResponse> BugReportResponses => Set<BugReportResponse>();
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder builder)
|
||||
{
|
||||
builder.HasDefaultSchema("support");
|
||||
|
||||
builder.Entity<BugReport>(e =>
|
||||
{
|
||||
e.ToTable("bug_reports");
|
||||
e.HasKey(b => b.Id);
|
||||
e.HasIndex(b => b.SubmitterAccountId);
|
||||
e.HasIndex(b => b.Status);
|
||||
e.HasIndex(b => b.CreatedAt);
|
||||
e.HasMany(b => b.Responses)
|
||||
.WithOne(r => r.BugReport)
|
||||
.HasForeignKey(r => r.BugReportId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
builder.Entity<BugReportResponse>(e =>
|
||||
{
|
||||
e.ToTable("bug_report_responses");
|
||||
e.HasKey(r => r.Id);
|
||||
e.HasIndex(r => r.BugReportId);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -101,3 +101,15 @@ public sealed class GameDbContextFactory
|
||||
return new GameDbContext(opts);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class SupportDbContextFactory
|
||||
: IDesignTimeDbContextFactory<SupportDbContext>
|
||||
{
|
||||
public SupportDbContext CreateDbContext(string[] args)
|
||||
{
|
||||
var opts = new DbContextOptionsBuilder<SupportDbContext>()
|
||||
.UseNpgsql(DesignTimeHelper.ResolveConnectionString("Support"))
|
||||
.Options;
|
||||
return new SupportDbContext(opts);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
namespace SOR.Database.Entities.Support;
|
||||
|
||||
/// <summary>
|
||||
/// A bug report submitted by a player from the in-game bug report dialog.
|
||||
/// Admin staff can respond via the admin panel; responses create a Notification
|
||||
/// of type "admin_response" so the player sees them in their in-game mailbox.
|
||||
/// </summary>
|
||||
public sealed class BugReport
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
/// <summary>Cross-schema: identity.accounts.Id of the submitter.</summary>
|
||||
public Guid SubmitterAccountId { get; set; }
|
||||
|
||||
/// <summary>Snapshot of the display name at submission time.</summary>
|
||||
public string SubmitterDisplayName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>Category chosen by the player: "gameplay", "ui", "account", "performance", "other".</summary>
|
||||
public string Category { get; set; } = "other";
|
||||
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public string Description { get; set; } = string.Empty;
|
||||
public string? StepsToReproduce { get; set; }
|
||||
|
||||
/// <summary>Workflow status: "Open", "InProgress", "Resolved", "Closed".</summary>
|
||||
public string Status { get; set; } = "Open";
|
||||
|
||||
public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow;
|
||||
public DateTimeOffset? UpdatedAt { get; set; }
|
||||
|
||||
public ICollection<BugReportResponse> Responses { get; set; } = [];
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
namespace SOR.Database.Entities.Support;
|
||||
|
||||
/// <summary>
|
||||
/// An admin staff response to a player bug report.
|
||||
/// Creating a response also triggers a Notification (chat schema) to the submitter.
|
||||
/// </summary>
|
||||
public sealed class BugReportResponse
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
public Guid BugReportId { get; set; }
|
||||
public BugReport BugReport { get; set; } = null!;
|
||||
|
||||
/// <summary>Cross-schema: identity.accounts.Id of the admin who responded.</summary>
|
||||
public Guid AdminAccountId { get; set; }
|
||||
|
||||
/// <summary>Snapshot of the admin's display name at response time.</summary>
|
||||
public string AdminDisplayName { get; set; } = string.Empty;
|
||||
|
||||
public string Content { get; set; } = string.Empty;
|
||||
|
||||
public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow;
|
||||
}
|
||||
+126
@@ -0,0 +1,126 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using SOR.Database.Contexts;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SOR.Database.Migrations.Support
|
||||
{
|
||||
[DbContext(typeof(SupportDbContext))]
|
||||
[Migration("20260307011156_AddSupport")]
|
||||
partial class AddSupport
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasDefaultSchema("support")
|
||||
.HasAnnotation("ProductVersion", "8.0.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Support.BugReport", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Category")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("StepsToReproduce")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("SubmitterAccountId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("SubmitterDisplayName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset?>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CreatedAt");
|
||||
|
||||
b.HasIndex("Status");
|
||||
|
||||
b.HasIndex("SubmitterAccountId");
|
||||
|
||||
b.ToTable("bug_reports", "support");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Support.BugReportResponse", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("AdminAccountId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("AdminDisplayName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("BugReportId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Content")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("BugReportId");
|
||||
|
||||
b.ToTable("bug_report_responses", "support");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Support.BugReportResponse", b =>
|
||||
{
|
||||
b.HasOne("SOR.Database.Entities.Support.BugReport", "BugReport")
|
||||
.WithMany("Responses")
|
||||
.HasForeignKey("BugReportId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("BugReport");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Support.BugReport", b =>
|
||||
{
|
||||
b.Navigation("Responses");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SOR.Database.Migrations.Support
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddSupport : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.EnsureSchema(
|
||||
name: "support");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "bug_reports",
|
||||
schema: "support",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
SubmitterAccountId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
SubmitterDisplayName = table.Column<string>(type: "text", nullable: false),
|
||||
Category = table.Column<string>(type: "text", nullable: false),
|
||||
Title = table.Column<string>(type: "text", nullable: false),
|
||||
Description = table.Column<string>(type: "text", nullable: false),
|
||||
StepsToReproduce = table.Column<string>(type: "text", nullable: true),
|
||||
Status = table.Column<string>(type: "text", nullable: false),
|
||||
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||||
UpdatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_bug_reports", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "bug_report_responses",
|
||||
schema: "support",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
BugReportId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
AdminAccountId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
AdminDisplayName = table.Column<string>(type: "text", nullable: false),
|
||||
Content = table.Column<string>(type: "text", nullable: false),
|
||||
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_bug_report_responses", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_bug_report_responses_bug_reports_BugReportId",
|
||||
column: x => x.BugReportId,
|
||||
principalSchema: "support",
|
||||
principalTable: "bug_reports",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_bug_report_responses_BugReportId",
|
||||
schema: "support",
|
||||
table: "bug_report_responses",
|
||||
column: "BugReportId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_bug_reports_CreatedAt",
|
||||
schema: "support",
|
||||
table: "bug_reports",
|
||||
column: "CreatedAt");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_bug_reports_Status",
|
||||
schema: "support",
|
||||
table: "bug_reports",
|
||||
column: "Status");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_bug_reports_SubmitterAccountId",
|
||||
schema: "support",
|
||||
table: "bug_reports",
|
||||
column: "SubmitterAccountId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "bug_report_responses",
|
||||
schema: "support");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "bug_reports",
|
||||
schema: "support");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using SOR.Database.Contexts;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SOR.Database.Migrations.Support
|
||||
{
|
||||
[DbContext(typeof(SupportDbContext))]
|
||||
partial class SupportDbContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasDefaultSchema("support")
|
||||
.HasAnnotation("ProductVersion", "8.0.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Support.BugReport", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Category")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("StepsToReproduce")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("SubmitterAccountId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("SubmitterDisplayName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset?>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CreatedAt");
|
||||
|
||||
b.HasIndex("Status");
|
||||
|
||||
b.HasIndex("SubmitterAccountId");
|
||||
|
||||
b.ToTable("bug_reports", "support");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Support.BugReportResponse", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("AdminAccountId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("AdminDisplayName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("BugReportId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Content")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("BugReportId");
|
||||
|
||||
b.ToTable("bug_report_responses", "support");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Support.BugReportResponse", b =>
|
||||
{
|
||||
b.HasOne("SOR.Database.Entities.Support.BugReport", "BugReport")
|
||||
.WithMany("Responses")
|
||||
.HasForeignKey("BugReportId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("BugReport");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Support.BugReport", b =>
|
||||
{
|
||||
b.Navigation("Responses");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -72,6 +72,15 @@ public static class ServiceRegistration
|
||||
return services;
|
||||
}
|
||||
|
||||
public static IServiceCollection AddSupportDatabase(
|
||||
this IServiceCollection services,
|
||||
IConfiguration configuration)
|
||||
{
|
||||
services.AddDbContext<SupportDbContext>(opts =>
|
||||
opts.UseNpgsql(Resolve(configuration, "Support")));
|
||||
return services;
|
||||
}
|
||||
|
||||
// ── Helpers ───────────────────────────────────────────────────────────────
|
||||
|
||||
private static string Resolve(IConfiguration configuration, string contextName)
|
||||
|
||||
Reference in New Issue
Block a user