Add Events Service - Career mode unlocked! (96% complete)
EVENTS SERVICE (4/4 endpoints - 100%):
- GET /synergy/events/active - List active events with player progress
- GET /synergy/events/{eventId} - Event details and requirements
- POST /synergy/events/{eventId}/start - Start event attempt
- POST /synergy/events/{eventId}/complete - Submit results, award rewards
Features:
- Track player progression through career events
- Personal best detection with improvement bonuses
- Reduced rewards on replays (prevents farming)
- Full integration with user/session system
Database:
- Events table (16 columns) with series/event organization
- EventCompletions table for player progress tracking
- EventAttempts table for session management
- Migration AddEventsSystem applied successfully
Documentation:
- AUTHENTICATION-ANALYSIS.md - Proof .NET implementation is correct
- BINARY-PATCH-ANALYSIS.md - ARM64 patch analysis
Server progress: 70/73 endpoints (96%)
Career mode now fully functional!
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
1265
RR3CommunityServer/Migrations/20260223015552_AddEventsSystem.Designer.cs
generated
Normal file
1265
RR3CommunityServer/Migrations/20260223015552_AddEventsSystem.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
205
RR3CommunityServer/Migrations/20260223015552_AddEventsSystem.cs
Normal file
205
RR3CommunityServer/Migrations/20260223015552_AddEventsSystem.cs
Normal file
@@ -0,0 +1,205 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace RR3CommunityServer.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddEventsSystem : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Events",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
EventCode = table.Column<string>(type: "TEXT", nullable: false),
|
||||
Name = table.Column<string>(type: "TEXT", nullable: false),
|
||||
SeriesName = table.Column<string>(type: "TEXT", nullable: false),
|
||||
SeriesOrder = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
EventOrder = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
Track = table.Column<string>(type: "TEXT", nullable: false),
|
||||
EventType = table.Column<string>(type: "TEXT", nullable: false),
|
||||
Laps = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
RequiredPR = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
RequiredCarClass = table.Column<string>(type: "TEXT", nullable: true),
|
||||
TargetTime = table.Column<double>(type: "REAL", nullable: true),
|
||||
GoldReward = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
CashReward = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
XPReward = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
Active = table.Column<bool>(type: "INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Events", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "EventAttempts",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
UserId = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
EventId = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
StartedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
Completed = table.Column<bool>(type: "INTEGER", nullable: false),
|
||||
CompletedAt = table.Column<DateTime>(type: "TEXT", nullable: true),
|
||||
TimeSeconds = table.Column<double>(type: "REAL", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_EventAttempts", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_EventAttempts_Events_EventId",
|
||||
column: x => x.EventId,
|
||||
principalTable: "Events",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_EventAttempts_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "EventCompletions",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
UserId = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
EventId = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
BestTime = table.Column<double>(type: "REAL", nullable: false),
|
||||
CompletionCount = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
FirstCompletedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
LastCompletedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_EventCompletions", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_EventCompletions_Events_EventId",
|
||||
column: x => x.EventId,
|
||||
principalTable: "Events",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_EventCompletions_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "TimeTrials",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
columns: new[] { "EndDate", "StartDate" },
|
||||
values: new object[] { new DateTime(2026, 3, 2, 1, 55, 50, 958, DateTimeKind.Utc).AddTicks(35), new DateTime(2026, 2, 23, 1, 55, 50, 958, DateTimeKind.Utc).AddTicks(32) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "TimeTrials",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2,
|
||||
columns: new[] { "EndDate", "StartDate" },
|
||||
values: new object[] { new DateTime(2026, 3, 2, 1, 55, 50, 958, DateTimeKind.Utc).AddTicks(43), new DateTime(2026, 2, 23, 1, 55, 50, 958, DateTimeKind.Utc).AddTicks(43) });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TimeTrialResults_TimeTrialId",
|
||||
table: "TimeTrialResults",
|
||||
column: "TimeTrialId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TimeTrialResults_UserId",
|
||||
table: "TimeTrialResults",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EventAttempts_EventId",
|
||||
table: "EventAttempts",
|
||||
column: "EventId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EventAttempts_UserId",
|
||||
table: "EventAttempts",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EventCompletions_EventId",
|
||||
table: "EventCompletions",
|
||||
column: "EventId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EventCompletions_UserId",
|
||||
table: "EventCompletions",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_TimeTrialResults_TimeTrials_TimeTrialId",
|
||||
table: "TimeTrialResults",
|
||||
column: "TimeTrialId",
|
||||
principalTable: "TimeTrials",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_TimeTrialResults_Users_UserId",
|
||||
table: "TimeTrialResults",
|
||||
column: "UserId",
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_TimeTrialResults_TimeTrials_TimeTrialId",
|
||||
table: "TimeTrialResults");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_TimeTrialResults_Users_UserId",
|
||||
table: "TimeTrialResults");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "EventAttempts");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "EventCompletions");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Events");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_TimeTrialResults_TimeTrialId",
|
||||
table: "TimeTrialResults");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_TimeTrialResults_UserId",
|
||||
table: "TimeTrialResults");
|
||||
|
||||
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) });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -408,6 +408,133 @@ namespace RR3CommunityServer.Migrations
|
||||
b.ToTable("Devices");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RR3CommunityServer.Data.Event", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<bool>("Active")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("CashReward")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("EventCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("EventOrder")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("EventType")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("GoldReward")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Laps")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("RequiredCarClass")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("RequiredPR")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("SeriesName")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("SeriesOrder")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<double?>("TargetTime")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<string>("Track")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("XPReward")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Events");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RR3CommunityServer.Data.EventAttempt", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<bool>("Completed")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime?>("CompletedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("EventId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("StartedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<double?>("TimeSeconds")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("EventId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("EventAttempts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RR3CommunityServer.Data.EventCompletion", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<double>("BestTime")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<int>("CompletionCount")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("EventId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("FirstCompletedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("LastCompletedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("EventId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("EventCompletions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RR3CommunityServer.Data.GameAsset", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@@ -822,10 +949,10 @@ namespace RR3CommunityServer.Migrations
|
||||
Active = true,
|
||||
CarName = "Any Car",
|
||||
CashReward = 10000,
|
||||
EndDate = new DateTime(2026, 3, 2, 1, 33, 39, 587, DateTimeKind.Utc).AddTicks(7946),
|
||||
EndDate = new DateTime(2026, 3, 2, 1, 55, 50, 958, DateTimeKind.Utc).AddTicks(35),
|
||||
GoldReward = 50,
|
||||
Name = "Daily Sprint Challenge",
|
||||
StartDate = new DateTime(2026, 2, 23, 1, 33, 39, 587, DateTimeKind.Utc).AddTicks(7944),
|
||||
StartDate = new DateTime(2026, 2, 23, 1, 55, 50, 958, DateTimeKind.Utc).AddTicks(32),
|
||||
TargetTime = 90.5,
|
||||
TrackName = "Silverstone National"
|
||||
},
|
||||
@@ -835,10 +962,10 @@ namespace RR3CommunityServer.Migrations
|
||||
Active = true,
|
||||
CarName = "Any Car",
|
||||
CashReward = 25000,
|
||||
EndDate = new DateTime(2026, 3, 2, 1, 33, 39, 587, DateTimeKind.Utc).AddTicks(7954),
|
||||
EndDate = new DateTime(2026, 3, 2, 1, 55, 50, 958, DateTimeKind.Utc).AddTicks(43),
|
||||
GoldReward = 100,
|
||||
Name = "Speed Demon Trial",
|
||||
StartDate = new DateTime(2026, 2, 23, 1, 33, 39, 587, DateTimeKind.Utc).AddTicks(7954),
|
||||
StartDate = new DateTime(2026, 2, 23, 1, 55, 50, 958, DateTimeKind.Utc).AddTicks(43),
|
||||
TargetTime = 120.0,
|
||||
TrackName = "Dubai Autodrome"
|
||||
});
|
||||
@@ -873,6 +1000,10 @@ namespace RR3CommunityServer.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TimeTrialId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("TimeTrialResults");
|
||||
});
|
||||
|
||||
@@ -1028,6 +1159,44 @@ namespace RR3CommunityServer.Migrations
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RR3CommunityServer.Data.EventAttempt", b =>
|
||||
{
|
||||
b.HasOne("RR3CommunityServer.Data.Event", "Event")
|
||||
.WithMany()
|
||||
.HasForeignKey("EventId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("RR3CommunityServer.Data.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Event");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RR3CommunityServer.Data.EventCompletion", b =>
|
||||
{
|
||||
b.HasOne("RR3CommunityServer.Data.Event", "Event")
|
||||
.WithMany()
|
||||
.HasForeignKey("EventId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("RR3CommunityServer.Data.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Event");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RR3CommunityServer.Data.OwnedCar", b =>
|
||||
{
|
||||
b.HasOne("RR3CommunityServer.Data.User", null)
|
||||
@@ -1037,6 +1206,25 @@ namespace RR3CommunityServer.Migrations
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RR3CommunityServer.Data.TimeTrialResult", b =>
|
||||
{
|
||||
b.HasOne("RR3CommunityServer.Data.TimeTrial", "TimeTrial")
|
||||
.WithMany()
|
||||
.HasForeignKey("TimeTrialId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("RR3CommunityServer.Data.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("TimeTrial");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RR3CommunityServer.Models.Account", b =>
|
||||
{
|
||||
b.HasOne("RR3CommunityServer.Data.User", "User")
|
||||
|
||||
Reference in New Issue
Block a user