Add viewer-range categories, nomination tracking, dynamic showact form, session timeout, share URLs, and workflow-per-season

Features:
- Category viewer ranges + subcategory templates (admin group modal, tree workspace)
- Nomination enrichment via TwitchTracker API (NominationEnrichmentService,
  TwitchTrackerViewerStatsProvider) with admin tracking rules editor
- Nomination group tracker: CategoryGroupName as primary identifier,
  CategoryId stays as nullable legacy field; StreamerIdentity table
- Dynamic showact application form builder (AdminShowactFormBuilder,
  ShowactApplicationSchedule)
- Session idle timeout setting (AdminSessionTimeoutCard)
- Share URLs for X and Discord (SiteSettings, public extras)
- Workflow rules now stored per season (falls back to global SiteSettings)
- New admin routes: settings/access, settings/workflows, tracking-rules
- New admin review workspace with subcategory tabs
- AdminCategoriesView rebuilt with group/subcategory modals

Migrations (all additive):
- AddShareUrls, AddShowactDynamicForm, AddCategoryViewerRanges,
  AddSessionIdleTimeoutSettings, AddSeasonSubcategoryTemplates,
  AddNominationGroupTrackerIdentity, AddShowactApplicationSchedule,
  AddSeasonWorkflowRulesJson

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
AzuTear
2026-06-28 23:32:21 +02:00
parent 4b2c5fa15d
commit b53c7fb736
178 changed files with 28933 additions and 1908 deletions
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,47 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Backend.Migrations
{
/// <inheritdoc />
public partial class AddShareUrls : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "ShareDiscordUrl",
table: "SiteSettings",
type: "text",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<string>(
name: "ShareXUrl",
table: "SiteSettings",
type: "text",
nullable: false,
defaultValue: "");
migrationBuilder.UpdateData(
table: "SiteSettings",
keyColumn: "Id",
keyValue: 1,
columns: new[] { "ShareDiscordUrl", "ShareXUrl" },
values: new object[] { "", "" });
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ShareDiscordUrl",
table: "SiteSettings");
migrationBuilder.DropColumn(
name: "ShareXUrl",
table: "SiteSettings");
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,47 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Backend.Migrations
{
/// <inheritdoc />
public partial class AddShowactDynamicForm : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "ShowactFormSchemaJson",
table: "SiteSettings",
type: "text",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<string>(
name: "FieldResponsesJson",
table: "ShowactApplications",
type: "text",
nullable: false,
defaultValue: "");
migrationBuilder.UpdateData(
table: "SiteSettings",
keyColumn: "Id",
keyValue: 1,
column: "ShowactFormSchemaJson",
value: "[]");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ShowactFormSchemaJson",
table: "SiteSettings");
migrationBuilder.DropColumn(
name: "FieldResponsesJson",
table: "ShowactApplications");
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,108 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Backend.Migrations
{
/// <inheritdoc />
public partial class AddCategoryViewerRanges : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "ViewerRangeMax",
table: "Categories",
type: "integer",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "ViewerRangeMin",
table: "Categories",
type: "integer",
nullable: true);
migrationBuilder.UpdateData(
table: "Categories",
keyColumn: "Id",
keyValue: 1,
columns: new[] { "ViewerRangeMax", "ViewerRangeMin" },
values: new object[] { null, null });
migrationBuilder.UpdateData(
table: "Categories",
keyColumn: "Id",
keyValue: 2,
columns: new[] { "ViewerRangeMax", "ViewerRangeMin" },
values: new object[] { null, null });
migrationBuilder.UpdateData(
table: "Categories",
keyColumn: "Id",
keyValue: 3,
columns: new[] { "ViewerRangeMax", "ViewerRangeMin" },
values: new object[] { null, null });
migrationBuilder.UpdateData(
table: "Categories",
keyColumn: "Id",
keyValue: 4,
columns: new[] { "ViewerRangeMax", "ViewerRangeMin" },
values: new object[] { null, null });
migrationBuilder.UpdateData(
table: "Categories",
keyColumn: "Id",
keyValue: 5,
columns: new[] { "ViewerRangeMax", "ViewerRangeMin" },
values: new object[] { null, null });
migrationBuilder.UpdateData(
table: "Categories",
keyColumn: "Id",
keyValue: 6,
columns: new[] { "ViewerRangeMax", "ViewerRangeMin" },
values: new object[] { null, null });
migrationBuilder.UpdateData(
table: "Categories",
keyColumn: "Id",
keyValue: 7,
columns: new[] { "ViewerRangeMax", "ViewerRangeMin" },
values: new object[] { null, null });
migrationBuilder.UpdateData(
table: "Categories",
keyColumn: "Id",
keyValue: 8,
columns: new[] { "ViewerRangeMax", "ViewerRangeMin" },
values: new object[] { null, null });
migrationBuilder.UpdateData(
table: "Categories",
keyColumn: "Id",
keyValue: 9,
columns: new[] { "ViewerRangeMax", "ViewerRangeMin" },
values: new object[] { null, null });
migrationBuilder.UpdateData(
table: "Categories",
keyColumn: "Id",
keyValue: 10,
columns: new[] { "ViewerRangeMax", "ViewerRangeMin" },
values: new object[] { null, null });
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ViewerRangeMax",
table: "Categories");
migrationBuilder.DropColumn(
name: "ViewerRangeMin",
table: "Categories");
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,36 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Backend.Migrations
{
/// <inheritdoc />
public partial class AddSessionIdleTimeoutSettings : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "SessionIdleTimeoutHours",
table: "SiteSettings",
type: "integer",
nullable: false,
defaultValue: 3);
migrationBuilder.UpdateData(
table: "SiteSettings",
keyColumn: "Id",
keyValue: 1,
column: "SessionIdleTimeoutHours",
value: 3);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "SessionIdleTimeoutHours",
table: "SiteSettings");
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,57 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Backend.Migrations
{
/// <inheritdoc />
public partial class AddSeasonSubcategoryTemplates : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "SubcategoryTemplatesJson",
table: "Seasons",
type: "text",
nullable: false,
defaultValue: "[]");
migrationBuilder.UpdateData(
table: "Seasons",
keyColumn: "Id",
keyValue: 1,
column: "SubcategoryTemplatesJson",
value: "[]");
migrationBuilder.UpdateData(
table: "Seasons",
keyColumn: "Id",
keyValue: 2,
column: "SubcategoryTemplatesJson",
value: "[]");
migrationBuilder.UpdateData(
table: "Seasons",
keyColumn: "Id",
keyValue: 3,
column: "SubcategoryTemplatesJson",
value: "[]");
migrationBuilder.UpdateData(
table: "Seasons",
keyColumn: "Id",
keyValue: 4,
column: "SubcategoryTemplatesJson",
value: "[]");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "SubcategoryTemplatesJson",
table: "Seasons");
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,388 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Backend.Migrations
{
/// <inheritdoc />
public partial class AddNominationGroupTrackerIdentity : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Nominations_Categories_CategoryId",
table: "Nominations");
migrationBuilder.AlterColumn<int>(
name: "CategoryId",
table: "Nominations",
type: "integer",
nullable: true,
oldClrType: typeof(int),
oldType: "integer");
migrationBuilder.AddColumn<int>(
name: "AvgViewers",
table: "Nominations",
type: "integer",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "CategoryGroupName",
table: "Nominations",
type: "character varying(80)",
maxLength: 80,
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<string>(
name: "ResolvedChannel",
table: "Nominations",
type: "character varying(120)",
maxLength: 120,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "ResolvedPlatform",
table: "Nominations",
type: "character varying(40)",
maxLength: 40,
nullable: true);
migrationBuilder.AddColumn<int>(
name: "StreamerIdentityId",
table: "Nominations",
type: "integer",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "SuggestedCategoryId",
table: "Nominations",
type: "integer",
nullable: true);
migrationBuilder.AddColumn<DateTimeOffset>(
name: "TrackerCheckedAt",
table: "Nominations",
type: "timestamp with time zone",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "TrackerStatus",
table: "Nominations",
type: "character varying(40)",
maxLength: 40,
nullable: false,
defaultValue: "pending");
migrationBuilder.AddColumn<int>(
name: "NominationTally",
table: "Candidates",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "StreamerIdentityId",
table: "Candidates",
type: "integer",
nullable: true);
migrationBuilder.CreateTable(
name: "StreamerIdentities",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Platform = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
Login = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
NormalizedKey = table.Column<string>(type: "character varying(180)", maxLength: 180, nullable: false),
DisplayName = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
ProfileUrl = table.Column<string>(type: "character varying(500)", maxLength: 500, nullable: true),
LastResolvedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_StreamerIdentities", x => x.Id);
});
migrationBuilder.UpdateData(
table: "Candidates",
keyColumn: "Id",
keyValue: 1,
column: "StreamerIdentityId",
value: null);
migrationBuilder.UpdateData(
table: "Candidates",
keyColumn: "Id",
keyValue: 2,
column: "StreamerIdentityId",
value: null);
migrationBuilder.UpdateData(
table: "Candidates",
keyColumn: "Id",
keyValue: 3,
column: "StreamerIdentityId",
value: null);
migrationBuilder.UpdateData(
table: "Candidates",
keyColumn: "Id",
keyValue: 4,
column: "StreamerIdentityId",
value: null);
migrationBuilder.UpdateData(
table: "Candidates",
keyColumn: "Id",
keyValue: 5,
column: "StreamerIdentityId",
value: null);
migrationBuilder.UpdateData(
table: "Candidates",
keyColumn: "Id",
keyValue: 6,
column: "StreamerIdentityId",
value: null);
migrationBuilder.UpdateData(
table: "Candidates",
keyColumn: "Id",
keyValue: 7,
column: "StreamerIdentityId",
value: null);
migrationBuilder.UpdateData(
table: "Candidates",
keyColumn: "Id",
keyValue: 8,
column: "StreamerIdentityId",
value: null);
migrationBuilder.UpdateData(
table: "Candidates",
keyColumn: "Id",
keyValue: 9,
column: "StreamerIdentityId",
value: null);
migrationBuilder.UpdateData(
table: "Candidates",
keyColumn: "Id",
keyValue: 10,
column: "StreamerIdentityId",
value: null);
migrationBuilder.UpdateData(
table: "Candidates",
keyColumn: "Id",
keyValue: 11,
column: "StreamerIdentityId",
value: null);
migrationBuilder.UpdateData(
table: "Candidates",
keyColumn: "Id",
keyValue: 12,
column: "StreamerIdentityId",
value: null);
migrationBuilder.UpdateData(
table: "Candidates",
keyColumn: "Id",
keyValue: 13,
column: "StreamerIdentityId",
value: null);
migrationBuilder.UpdateData(
table: "Nominations",
keyColumn: "Id",
keyValue: 1,
columns: new[] { "AvgViewers", "CategoryGroupName", "ResolvedChannel", "ResolvedPlatform", "StreamerIdentityId", "SuggestedCategoryId", "TrackerCheckedAt", "TrackerStatus" },
values: new object[] { null, "", null, null, null, null, null, "pending" });
migrationBuilder.UpdateData(
table: "Nominations",
keyColumn: "Id",
keyValue: 2,
columns: new[] { "AvgViewers", "CategoryGroupName", "ResolvedChannel", "ResolvedPlatform", "StreamerIdentityId", "SuggestedCategoryId", "TrackerCheckedAt", "TrackerStatus" },
values: new object[] { null, "", null, null, null, null, null, "pending" });
migrationBuilder.Sql("""
UPDATE "Nominations" n
SET "CategoryGroupName" = c."GroupName"
FROM "Categories" c
WHERE n."CategoryId" = c."Id"
AND COALESCE(n."CategoryGroupName", '') = '';
""");
migrationBuilder.CreateIndex(
name: "IX_Nominations_SeasonId_CategoryGroupName_Status",
table: "Nominations",
columns: new[] { "SeasonId", "CategoryGroupName", "Status" });
migrationBuilder.CreateIndex(
name: "IX_Nominations_SeasonId_StreamerIdentityId_CategoryGroupName",
table: "Nominations",
columns: new[] { "SeasonId", "StreamerIdentityId", "CategoryGroupName" });
migrationBuilder.CreateIndex(
name: "IX_Nominations_StreamerIdentityId",
table: "Nominations",
column: "StreamerIdentityId");
migrationBuilder.CreateIndex(
name: "IX_Nominations_SuggestedCategoryId",
table: "Nominations",
column: "SuggestedCategoryId");
migrationBuilder.CreateIndex(
name: "IX_Candidates_StreamerIdentityId",
table: "Candidates",
column: "StreamerIdentityId");
migrationBuilder.CreateIndex(
name: "IX_StreamerIdentities_NormalizedKey",
table: "StreamerIdentities",
column: "NormalizedKey",
unique: true);
migrationBuilder.AddForeignKey(
name: "FK_Candidates_StreamerIdentities_StreamerIdentityId",
table: "Candidates",
column: "StreamerIdentityId",
principalTable: "StreamerIdentities",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Nominations_Categories_CategoryId",
table: "Nominations",
column: "CategoryId",
principalTable: "Categories",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_Nominations_Categories_SuggestedCategoryId",
table: "Nominations",
column: "SuggestedCategoryId",
principalTable: "Categories",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_Nominations_StreamerIdentities_StreamerIdentityId",
table: "Nominations",
column: "StreamerIdentityId",
principalTable: "StreamerIdentities",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Candidates_StreamerIdentities_StreamerIdentityId",
table: "Candidates");
migrationBuilder.DropForeignKey(
name: "FK_Nominations_Categories_CategoryId",
table: "Nominations");
migrationBuilder.DropForeignKey(
name: "FK_Nominations_Categories_SuggestedCategoryId",
table: "Nominations");
migrationBuilder.DropForeignKey(
name: "FK_Nominations_StreamerIdentities_StreamerIdentityId",
table: "Nominations");
migrationBuilder.DropTable(
name: "StreamerIdentities");
migrationBuilder.DropIndex(
name: "IX_Nominations_SeasonId_CategoryGroupName_Status",
table: "Nominations");
migrationBuilder.DropIndex(
name: "IX_Nominations_SeasonId_StreamerIdentityId_CategoryGroupName",
table: "Nominations");
migrationBuilder.DropIndex(
name: "IX_Nominations_StreamerIdentityId",
table: "Nominations");
migrationBuilder.DropIndex(
name: "IX_Nominations_SuggestedCategoryId",
table: "Nominations");
migrationBuilder.DropIndex(
name: "IX_Candidates_StreamerIdentityId",
table: "Candidates");
migrationBuilder.DropColumn(
name: "AvgViewers",
table: "Nominations");
migrationBuilder.DropColumn(
name: "CategoryGroupName",
table: "Nominations");
migrationBuilder.DropColumn(
name: "ResolvedChannel",
table: "Nominations");
migrationBuilder.DropColumn(
name: "ResolvedPlatform",
table: "Nominations");
migrationBuilder.DropColumn(
name: "StreamerIdentityId",
table: "Nominations");
migrationBuilder.DropColumn(
name: "SuggestedCategoryId",
table: "Nominations");
migrationBuilder.DropColumn(
name: "TrackerCheckedAt",
table: "Nominations");
migrationBuilder.DropColumn(
name: "TrackerStatus",
table: "Nominations");
migrationBuilder.DropColumn(
name: "NominationTally",
table: "Candidates");
migrationBuilder.DropColumn(
name: "StreamerIdentityId",
table: "Candidates");
migrationBuilder.AlterColumn<int>(
name: "CategoryId",
table: "Nominations",
type: "integer",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "integer",
oldNullable: true);
migrationBuilder.AddForeignKey(
name: "FK_Nominations_Categories_CategoryId",
table: "Nominations",
column: "CategoryId",
principalTable: "Categories",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,46 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Backend.Migrations
{
/// <inheritdoc />
public partial class AddShowactApplicationSchedule : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<DateOnly>(
name: "ShowactApplicationEndsAt",
table: "SiteSettings",
type: "date",
nullable: true);
migrationBuilder.AddColumn<DateOnly>(
name: "ShowactApplicationStartsAt",
table: "SiteSettings",
type: "date",
nullable: true);
migrationBuilder.UpdateData(
table: "SiteSettings",
keyColumn: "Id",
keyValue: 1,
columns: new[] { "ShowactApplicationEndsAt", "ShowactApplicationStartsAt" },
values: new object[] { null, null });
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ShowactApplicationEndsAt",
table: "SiteSettings");
migrationBuilder.DropColumn(
name: "ShowactApplicationStartsAt",
table: "SiteSettings");
}
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,36 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Backend.Migrations
{
/// <inheritdoc />
public partial class AddSeasonWorkflowRulesJson : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "WorkflowRulesJson",
table: "Seasons",
type: "text",
nullable: false,
defaultValue: "[]");
migrationBuilder.Sql(
"""
UPDATE "Seasons"
SET "WorkflowRulesJson" = COALESCE(NULLIF((SELECT "WorkflowRulesJson" FROM "SiteSettings" WHERE "Id" = 1), ''), '[]')
WHERE COALESCE("WorkflowRulesJson", '') = '';
""");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "WorkflowRulesJson",
table: "Seasons");
}
}
}
File diff suppressed because one or more lines are too long