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:
2026-02-23 12:10:31 -08:00
parent a6167c8249
commit 4736637c3c
7 changed files with 2990 additions and 4 deletions

View File

@@ -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")