mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-10 23:31:27 +00:00
Implement property dependency injection for the website (#806)
* Remove most non DI usages of DbContext * Optimize website queries and refactor startup to use top level statements * Remove unused functions in UserEntity and SlotEntity * Optimize LBP1 LevelTags
This commit is contained in:
parent
727dd4e903
commit
e43397ac6a
47 changed files with 333 additions and 430 deletions
|
@ -98,17 +98,22 @@ public class MatchController : ControllerBase
|
|||
case FindBestRoom diveInData when MatchHelper.UserLocations.Count > 1:
|
||||
#endif
|
||||
{
|
||||
FindBestRoomResponse? response = RoomHelper.FindBestRoom
|
||||
(user, token.GameVersion, diveInData.RoomSlot, token.Platform, token.UserLocation);
|
||||
FindBestRoomResponse? response = RoomHelper.FindBestRoom(this.database,
|
||||
user,
|
||||
token.GameVersion,
|
||||
diveInData.RoomSlot,
|
||||
token.Platform,
|
||||
token.UserLocation);
|
||||
|
||||
if (response == null) return this.NotFound();
|
||||
|
||||
string serialized = JsonSerializer.Serialize(response, typeof(FindBestRoomResponse));
|
||||
foreach (Player player in response.Players) MatchHelper.AddUserRecentlyDivedIn(user.UserId, player.User.UserId);
|
||||
foreach (Player player in response.Players)
|
||||
MatchHelper.AddUserRecentlyDivedIn(user.UserId, player.User.UserId);
|
||||
|
||||
return this.Ok($"[{{\"StatusCode\":200}},{serialized}]");
|
||||
}
|
||||
case CreateRoom createRoom when MatchHelper.UserLocations.Count >= 1:
|
||||
case CreateRoom createRoom when !MatchHelper.UserLocations.IsEmpty:
|
||||
{
|
||||
List<int> users = new();
|
||||
foreach (string playerUsername in createRoom.Players)
|
||||
|
@ -139,9 +144,8 @@ public class MatchController : ControllerBase
|
|||
}
|
||||
|
||||
room.PlayerIds = users.Select(u => u.UserId).ToList();
|
||||
await RoomHelper.CleanupRooms(null, room);
|
||||
await RoomHelper.CleanupRooms(this.database, null, room);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue