RECORDS & LEADERBOARDS (5/5 endpoints - 100%):
- Created LeaderboardsController with 5 endpoints
- GET /synergy/leaderboards/timetrials/{trialId}
- GET /synergy/leaderboards/career/{series}/{event}
- GET /synergy/leaderboards/global/top100
- GET /synergy/leaderboards/player/{synergyId}/records
- GET /synergy/leaderboards/compare/{synergyId1}/{synergyId2}
Added LeaderboardEntry and PersonalRecord models and database tables.
Migration applied: AddLeaderboardsAndRecords
Updated RewardsController.SubmitTimeTrial to track personal bests,
update leaderboards, and award 50 gold bonus for improvements.
Updated ProgressionController.CompleteCareerEvent similarly for
career event personal records.
TIME TRIALS (6/6 endpoints - 100%):
- GET /synergy/rewards/timetrials - List with time remaining
- GET /synergy/rewards/timetrials/{id} - Details with stats
- POST /synergy/rewards/timetrials/{id}/submit - Submit with PB tracking
- GET /synergy/rewards/timetrials/player/{synergyId}/results - History
- POST /synergy/rewards/timetrials/{id}/claim - Claim bonuses
- GET /synergy/leaderboards/timetrials/{id} - Leaderboards (above)
Added navigation properties to TimeTrialResult for easier queries.
Server progress: 66/73 endpoints (90%)
Two complete systems: Records/Leaderboards + Time Trials
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
96 lines
4.6 KiB
C#
96 lines
4.6 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace RR3CommunityServer.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddLeaderboardsAndRecords : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "LeaderboardEntries",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
SynergyId = table.Column<string>(type: "TEXT", nullable: false),
|
|
PlayerName = table.Column<string>(type: "TEXT", nullable: false),
|
|
RecordType = table.Column<string>(type: "TEXT", nullable: false),
|
|
RecordCategory = table.Column<string>(type: "TEXT", nullable: false),
|
|
TrackName = table.Column<string>(type: "TEXT", nullable: true),
|
|
CarName = table.Column<string>(type: "TEXT", nullable: true),
|
|
TimeSeconds = table.Column<double>(type: "REAL", nullable: false),
|
|
SubmittedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_LeaderboardEntries", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "PersonalRecords",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
SynergyId = table.Column<string>(type: "TEXT", nullable: false),
|
|
RecordType = table.Column<string>(type: "TEXT", nullable: false),
|
|
RecordCategory = table.Column<string>(type: "TEXT", nullable: false),
|
|
TrackName = table.Column<string>(type: "TEXT", nullable: true),
|
|
CarName = table.Column<string>(type: "TEXT", nullable: true),
|
|
BestTimeSeconds = table.Column<double>(type: "REAL", nullable: false),
|
|
AchievedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|
PreviousBestTime = table.Column<DateTime>(type: "TEXT", nullable: true),
|
|
ImprovementSeconds = table.Column<double>(type: "REAL", nullable: true),
|
|
TotalAttempts = table.Column<int>(type: "INTEGER", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_PersonalRecords", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "TimeTrials",
|
|
keyColumn: "Id",
|
|
keyValue: 1,
|
|
columns: new[] { "EndDate", "StartDate" },
|
|
values: new object[] { new DateTime(2026, 3, 2, 1, 33, 39, 587, DateTimeKind.Utc).AddTicks(7946), new DateTime(2026, 2, 23, 1, 33, 39, 587, DateTimeKind.Utc).AddTicks(7944) });
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "TimeTrials",
|
|
keyColumn: "Id",
|
|
keyValue: 2,
|
|
columns: new[] { "EndDate", "StartDate" },
|
|
values: new object[] { new DateTime(2026, 3, 2, 1, 33, 39, 587, DateTimeKind.Utc).AddTicks(7954), new DateTime(2026, 2, 23, 1, 33, 39, 587, DateTimeKind.Utc).AddTicks(7954) });
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "LeaderboardEntries");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "PersonalRecords");
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "TimeTrials",
|
|
keyColumn: "Id",
|
|
keyValue: 1,
|
|
columns: new[] { "EndDate", "StartDate" },
|
|
values: new object[] { new DateTime(2026, 3, 1, 7, 47, 46, 836, DateTimeKind.Utc).AddTicks(7182), new DateTime(2026, 2, 22, 7, 47, 46, 836, DateTimeKind.Utc).AddTicks(7180) });
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "TimeTrials",
|
|
keyColumn: "Id",
|
|
keyValue: 2,
|
|
columns: new[] { "EndDate", "StartDate" },
|
|
values: new object[] { new DateTime(2026, 3, 1, 7, 47, 46, 836, DateTimeKind.Utc).AddTicks(7192), new DateTime(2026, 2, 22, 7, 47, 46, 836, DateTimeKind.Utc).AddTicks(7191) });
|
|
}
|
|
}
|
|
}
|