Add Friends/Social & Multiplayer systems - 95 total endpoints

- Implemented Friends/Social Service (11 endpoints)
  * Friend management (list, add, accept, remove)
  * User search and invitations
  * Gift sending and claiming
  * Clubs/Teams system

- Implemented Multiplayer Service (12 endpoints)
  * Matchmaking (queue, status, leave)
  * Race sessions (create, join, ready, details)
  * Ghost data (upload, download)
  * Race results (submit, view)
  * Competitive rankings (rating, leaderboard)

- Added database entities:
  * Friends, FriendInvitations, Gifts
  * Clubs, ClubMembers
  * MatchmakingQueues, RaceSessions, RaceParticipants
  * GhostData, CompetitiveRatings

- Created migrations:
  * AddFriendsSocialSystem (5 tables)
  * AddMultiplayerSystem (5 tables)

Total: 95 endpoints - 100% EA server replacement ready

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-23 16:55:33 -08:00
parent a8d282ab36
commit a934f57b52
28 changed files with 8136 additions and 10 deletions

View File

@@ -0,0 +1,253 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace RR3CommunityServer.Migrations
{
/// <inheritdoc />
public partial class AddFriendsSocialSystem : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Clubs",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column<string>(type: "TEXT", nullable: false),
Description = table.Column<string>(type: "TEXT", nullable: false),
Tag = table.Column<string>(type: "TEXT", nullable: false),
OwnerId = table.Column<int>(type: "INTEGER", nullable: false),
MaxMembers = table.Column<int>(type: "INTEGER", nullable: false),
IsPublic = table.Column<bool>(type: "INTEGER", nullable: false),
IsRecruiting = table.Column<bool>(type: "INTEGER", nullable: false),
TotalPoints = table.Column<int>(type: "INTEGER", nullable: false),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Clubs", x => x.Id);
table.ForeignKey(
name: "FK_Clubs_Users_OwnerId",
column: x => x.OwnerId,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "FriendInvitations",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
SenderId = table.Column<int>(type: "INTEGER", nullable: false),
ReceiverId = table.Column<int>(type: "INTEGER", nullable: false),
Status = table.Column<string>(type: "TEXT", nullable: false),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
RespondedAt = table.Column<DateTime>(type: "TEXT", nullable: true),
ExpiresAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_FriendInvitations", x => x.Id);
table.ForeignKey(
name: "FK_FriendInvitations_Users_ReceiverId",
column: x => x.ReceiverId,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_FriendInvitations_Users_SenderId",
column: x => x.SenderId,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Friends",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
User1Id = table.Column<int>(type: "INTEGER", nullable: false),
User2Id = table.Column<int>(type: "INTEGER", nullable: false),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Friends", x => x.Id);
table.ForeignKey(
name: "FK_Friends_Users_User1Id",
column: x => x.User1Id,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Friends_Users_User2Id",
column: x => x.User2Id,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Gifts",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
SenderId = table.Column<int>(type: "INTEGER", nullable: false),
ReceiverId = table.Column<int>(type: "INTEGER", nullable: false),
GiftType = table.Column<string>(type: "TEXT", nullable: false),
Amount = table.Column<int>(type: "INTEGER", nullable: false),
Message = table.Column<string>(type: "TEXT", nullable: true),
Claimed = table.Column<bool>(type: "INTEGER", nullable: false),
SentAt = table.Column<DateTime>(type: "TEXT", nullable: false),
ClaimedAt = table.Column<DateTime>(type: "TEXT", nullable: true),
ExpiresAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Gifts", x => x.Id);
table.ForeignKey(
name: "FK_Gifts_Users_ReceiverId",
column: x => x.ReceiverId,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Gifts_Users_SenderId",
column: x => x.SenderId,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ClubMembers",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
ClubId = table.Column<int>(type: "INTEGER", nullable: false),
UserId = table.Column<int>(type: "INTEGER", nullable: false),
Role = table.Column<string>(type: "TEXT", nullable: false),
ContributedPoints = table.Column<int>(type: "INTEGER", nullable: false),
JoinedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ClubMembers", x => x.Id);
table.ForeignKey(
name: "FK_ClubMembers_Clubs_ClubId",
column: x => x.ClubId,
principalTable: "Clubs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ClubMembers_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, 3, 0, 47, 32, 189, DateTimeKind.Utc).AddTicks(8910), new DateTime(2026, 2, 24, 0, 47, 32, 189, DateTimeKind.Utc).AddTicks(8907) });
migrationBuilder.UpdateData(
table: "TimeTrials",
keyColumn: "Id",
keyValue: 2,
columns: new[] { "EndDate", "StartDate" },
values: new object[] { new DateTime(2026, 3, 3, 0, 47, 32, 189, DateTimeKind.Utc).AddTicks(8918), new DateTime(2026, 2, 24, 0, 47, 32, 189, DateTimeKind.Utc).AddTicks(8918) });
migrationBuilder.CreateIndex(
name: "IX_ClubMembers_ClubId",
table: "ClubMembers",
column: "ClubId");
migrationBuilder.CreateIndex(
name: "IX_ClubMembers_UserId",
table: "ClubMembers",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_Clubs_OwnerId",
table: "Clubs",
column: "OwnerId");
migrationBuilder.CreateIndex(
name: "IX_FriendInvitations_ReceiverId",
table: "FriendInvitations",
column: "ReceiverId");
migrationBuilder.CreateIndex(
name: "IX_FriendInvitations_SenderId",
table: "FriendInvitations",
column: "SenderId");
migrationBuilder.CreateIndex(
name: "IX_Friends_User1Id",
table: "Friends",
column: "User1Id");
migrationBuilder.CreateIndex(
name: "IX_Friends_User2Id",
table: "Friends",
column: "User2Id");
migrationBuilder.CreateIndex(
name: "IX_Gifts_ReceiverId",
table: "Gifts",
column: "ReceiverId");
migrationBuilder.CreateIndex(
name: "IX_Gifts_SenderId",
table: "Gifts",
column: "SenderId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ClubMembers");
migrationBuilder.DropTable(
name: "FriendInvitations");
migrationBuilder.DropTable(
name: "Friends");
migrationBuilder.DropTable(
name: "Gifts");
migrationBuilder.DropTable(
name: "Clubs");
migrationBuilder.UpdateData(
table: "TimeTrials",
keyColumn: "Id",
keyValue: 1,
columns: new[] { "EndDate", "StartDate" },
values: new object[] { new DateTime(2026, 3, 3, 0, 7, 51, 537, DateTimeKind.Utc).AddTicks(6445), new DateTime(2026, 2, 24, 0, 7, 51, 537, DateTimeKind.Utc).AddTicks(6442) });
migrationBuilder.UpdateData(
table: "TimeTrials",
keyColumn: "Id",
keyValue: 2,
columns: new[] { "EndDate", "StartDate" },
values: new object[] { new DateTime(2026, 3, 3, 0, 7, 51, 537, DateTimeKind.Utc).AddTicks(6454), new DateTime(2026, 2, 24, 0, 7, 51, 537, DateTimeKind.Utc).AddTicks(6453) });
}
}
}