From 284db74d0e5600ddfdb21fafac024aa4f77e9c7a Mon Sep 17 00:00:00 2001 From: Lapis <47952866+LapisGit@users.noreply.github.com> Date: Fri, 3 Apr 2026 23:34:03 -0400 Subject: [PATCH] random bullshit go reccenter still doesnt work --- CannedNet/Data/AppDbContext.cs | 2 +- ...057_RemoveUniqueOwnerAccountId.Designer.cs | 693 ++++++++++++++++++ ...260404002057_RemoveUniqueOwnerAccountId.cs | 37 + .../Migrations/AppDbContextModelSnapshot.cs | 3 +- CannedNet/Services/APIService.cs | 19 +- CannedNet/Services/CommerceService.cs | 2 +- CannedNet/Services/MatchmakingService.cs | 44 +- 7 files changed, 747 insertions(+), 53 deletions(-) create mode 100644 CannedNet/Migrations/20260404002057_RemoveUniqueOwnerAccountId.Designer.cs create mode 100644 CannedNet/Migrations/20260404002057_RemoveUniqueOwnerAccountId.cs diff --git a/CannedNet/Data/AppDbContext.cs b/CannedNet/Data/AppDbContext.cs index b736174..8057fa0 100644 --- a/CannedNet/Data/AppDbContext.cs +++ b/CannedNet/Data/AppDbContext.cs @@ -105,7 +105,7 @@ public class AppDbContext : DbContext entity.HasKey(e => e.Id); entity.Property(e => e.Id).ValueGeneratedOnAdd(); entity.Property(e => e.OwnerAccountId).IsRequired(); - entity.HasIndex(e => e.OwnerAccountId).IsUnique(); + entity.HasIndex(e => new { e.OwnerAccountId, e.roomId }); entity.ToTable("room_instances"); }); diff --git a/CannedNet/Migrations/20260404002057_RemoveUniqueOwnerAccountId.Designer.cs b/CannedNet/Migrations/20260404002057_RemoveUniqueOwnerAccountId.Designer.cs new file mode 100644 index 0000000..1b938f9 --- /dev/null +++ b/CannedNet/Migrations/20260404002057_RemoveUniqueOwnerAccountId.Designer.cs @@ -0,0 +1,693 @@ +// +using System; +using CannedNet.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace CannedNet.Migrations +{ + [DbContext(typeof(AppDbContext))] + [Migration("20260404002057_RemoveUniqueOwnerAccountId")] + partial class RemoveUniqueOwnerAccountId + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("CannedNet.Account", b => + { + b.Property("AccountId") + .HasColumnType("integer") + .HasAnnotation("Relational:JsonPropertyName", "accountId"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasAnnotation("Relational:JsonPropertyName", "createdAt"); + + b.Property("DisplayName") + .IsRequired() + .HasColumnType("text") + .HasAnnotation("Relational:JsonPropertyName", "displayName"); + + b.Property("IdentityFlags") + .HasColumnType("integer") + .HasAnnotation("Relational:JsonPropertyName", "identityFlags"); + + b.Property("IsJunior") + .HasColumnType("boolean") + .HasAnnotation("Relational:JsonPropertyName", "isJunior"); + + b.Property("PersonalPronouns") + .HasColumnType("integer") + .HasAnnotation("Relational:JsonPropertyName", "personalPronouns"); + + b.Property("Platforms") + .HasColumnType("integer") + .HasAnnotation("Relational:JsonPropertyName", "platforms"); + + b.Property("ProfileImage") + .HasColumnType("text") + .HasAnnotation("Relational:JsonPropertyName", "profileImage"); + + b.Property("Username") + .IsRequired() + .HasColumnType("text") + .HasAnnotation("Relational:JsonPropertyName", "username"); + + b.HasKey("AccountId"); + + b.ToTable("accounts", (string)null); + }); + + modelBuilder.Entity("CannedNet.AvatarItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AvatarItemDesc") + .IsRequired() + .HasColumnType("text") + .HasAnnotation("Relational:JsonPropertyName", "avatarItemDesc"); + + b.Property("AvatarItemType") + .HasColumnType("integer") + .HasAnnotation("Relational:JsonPropertyName", "avatarItemType"); + + b.Property("FriendlyName") + .IsRequired() + .HasColumnType("text") + .HasAnnotation("Relational:JsonPropertyName", "friendlyName"); + + b.Property("OwnerAccountId") + .HasColumnType("integer"); + + b.Property("PlatformMask") + .HasColumnType("integer") + .HasAnnotation("Relational:JsonPropertyName", "platformMask"); + + b.Property("Rarity") + .HasColumnType("integer") + .HasAnnotation("Relational:JsonPropertyName", "rarity"); + + b.Property("Tooltip") + .IsRequired() + .HasColumnType("text") + .HasAnnotation("Relational:JsonPropertyName", "tooltip"); + + b.HasKey("Id"); + + b.HasIndex("OwnerAccountId"); + + b.ToTable("avatar_items", (string)null); + }); + + modelBuilder.Entity("CannedNet.CachedLogin", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("integer") + .HasAnnotation("Relational:JsonPropertyName", "accountId"); + + b.Property("LastLoginTime") + .HasColumnType("timestamp with time zone") + .HasAnnotation("Relational:JsonPropertyName", "lastLoginTime"); + + b.Property("Platform") + .HasColumnType("integer") + .HasAnnotation("Relational:JsonPropertyName", "platform"); + + b.Property("PlatformID") + .IsRequired() + .HasColumnType("text") + .HasAnnotation("Relational:JsonPropertyName", "platformId"); + + b.Property("RequirePassword") + .HasColumnType("boolean") + .HasAnnotation("Relational:JsonPropertyName", "requirePassword"); + + b.HasKey("Id"); + + b.HasIndex("Platform", "PlatformID") + .IsUnique(); + + b.ToTable("cached_logins", (string)null); + }); + + modelBuilder.Entity("CannedNet.LoadScreen", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ImageUrl") + .IsRequired() + .HasColumnType("text") + .HasAnnotation("Relational:JsonPropertyName", "imageUrl"); + + b.Property("IsThumbnail") + .HasColumnType("boolean") + .HasAnnotation("Relational:JsonPropertyName", "isThumbnail"); + + b.Property("RoomId") + .HasColumnType("integer"); + + b.Property("Tooltip") + .IsRequired() + .HasColumnType("text") + .HasAnnotation("Relational:JsonPropertyName", "tooltip"); + + b.HasKey("Id"); + + b.HasIndex("RoomId"); + + b.ToTable("load_screens", (string)null); + }); + + modelBuilder.Entity("CannedNet.PlayerAvatar", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FaceFeatures") + .IsRequired() + .HasColumnType("text") + .HasAnnotation("Relational:JsonPropertyName", "FaceFeatures"); + + b.Property("HairColor") + .IsRequired() + .HasColumnType("text") + .HasAnnotation("Relational:JsonPropertyName", "HairColor"); + + b.Property("OutfitSelections") + .IsRequired() + .HasColumnType("text") + .HasAnnotation("Relational:JsonPropertyName", "OutfitSelections"); + + b.Property("OwnerAccountId") + .HasColumnType("integer"); + + b.Property("SkinColor") + .IsRequired() + .HasColumnType("text") + .HasAnnotation("Relational:JsonPropertyName", "SkinColor"); + + b.HasKey("Id"); + + b.HasIndex("OwnerAccountId") + .IsUnique(); + + b.ToTable("player_avatars", (string)null); + }); + + modelBuilder.Entity("CannedNet.PlayerProgression", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Level") + .HasColumnType("integer") + .HasAnnotation("Relational:JsonPropertyName", "level"); + + b.Property("PlayerId") + .HasColumnType("integer") + .HasAnnotation("Relational:JsonPropertyName", "playerId"); + + b.Property("Xp") + .HasColumnType("integer") + .HasAnnotation("Relational:JsonPropertyName", "xp"); + + b.HasKey("Id"); + + b.HasIndex("PlayerId") + .IsUnique(); + + b.ToTable("player_progressions", (string)null); + }); + + modelBuilder.Entity("CannedNet.PlayerSetting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Key") + .IsRequired() + .HasColumnType("text") + .HasAnnotation("Relational:JsonPropertyName", "key"); + + b.Property("PlayerId") + .HasColumnType("integer") + .HasAnnotation("Relational:JsonPropertyName", "playerId"); + + b.Property("Value") + .IsRequired() + .HasColumnType("text") + .HasAnnotation("Relational:JsonPropertyName", "value"); + + b.HasKey("Id"); + + b.HasIndex("PlayerId", "Key") + .IsUnique(); + + b.ToTable("player_settings", (string)null); + }); + + modelBuilder.Entity("CannedNet.PromoExternalContent", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("RoomId") + .HasColumnType("integer"); + + b.Property("Tooltip") + .IsRequired() + .HasColumnType("text") + .HasAnnotation("Relational:JsonPropertyName", "tooltip"); + + b.Property("Type") + .HasColumnType("integer") + .HasAnnotation("Relational:JsonPropertyName", "type"); + + b.Property("Url") + .IsRequired() + .HasColumnType("text") + .HasAnnotation("Relational:JsonPropertyName", "url"); + + b.HasKey("Id"); + + b.HasIndex("RoomId"); + + b.ToTable("promo_external_contents", (string)null); + }); + + modelBuilder.Entity("CannedNet.PromoImage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ImageUrl") + .IsRequired() + .HasColumnType("text") + .HasAnnotation("Relational:JsonPropertyName", "imageUrl"); + + b.Property("RoomId") + .HasColumnType("integer"); + + b.Property("SortOrder") + .HasColumnType("integer") + .HasAnnotation("Relational:JsonPropertyName", "sortOrder"); + + b.Property("Tooltip") + .IsRequired() + .HasColumnType("text") + .HasAnnotation("Relational:JsonPropertyName", "tooltip"); + + b.HasKey("Id"); + + b.HasIndex("RoomId"); + + b.ToTable("promo_images", (string)null); + }); + + modelBuilder.Entity("CannedNet.Room", b => + { + b.Property("Id") + .HasColumnType("integer"); + + b.Property("Accessibility") + .HasColumnType("integer") + .HasAnnotation("Relational:JsonPropertyName", "accessibility"); + + b.Property("CloningAllowed") + .HasColumnType("boolean") + .HasAnnotation("Relational:JsonPropertyName", "cloningAllowed"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasAnnotation("Relational:JsonPropertyName", "createdAt"); + + b.Property("CreatorAccountId") + .HasColumnType("integer") + .HasAnnotation("Relational:JsonPropertyName", "creatorAccountId"); + + b.Property("CustomWarning") + .HasColumnType("text") + .HasAnnotation("Relational:JsonPropertyName", "customWarning"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text") + .HasAnnotation("Relational:JsonPropertyName", "description"); + + b.Property("DisableMicAutoMute") + .HasColumnType("boolean") + .HasAnnotation("Relational:JsonPropertyName", "disableMicAutoMute"); + + b.Property("DisableRoomComments") + .HasColumnType("boolean") + .HasAnnotation("Relational:JsonPropertyName", "disableRoomComments"); + + b.Property("EncryptVoiceChat") + .HasColumnType("boolean") + .HasAnnotation("Relational:JsonPropertyName", "encryptVoiceChat"); + + b.Property("ImageName") + .IsRequired() + .HasColumnType("text") + .HasAnnotation("Relational:JsonPropertyName", "imageName"); + + b.Property("IsDorm") + .HasColumnType("boolean") + .HasAnnotation("Relational:JsonPropertyName", "isDorm"); + + b.Property("IsRRO") + .HasColumnType("boolean") + .HasAnnotation("Relational:JsonPropertyName", "isRRO"); + + b.Property("MinLevel") + .HasColumnType("integer") + .HasAnnotation("Relational:JsonPropertyName", "minLevel"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasAnnotation("Relational:JsonPropertyName", "name"); + + b.Property("RoomId") + .HasColumnType("integer") + .HasAnnotation("Relational:JsonPropertyName", "roomId"); + + b.Property("State") + .HasColumnType("integer") + .HasAnnotation("Relational:JsonPropertyName", "state"); + + b.Property("SupportsJuniors") + .HasColumnType("boolean") + .HasAnnotation("Relational:JsonPropertyName", "supportsJuniors"); + + b.Property("SupportsLevelVoting") + .HasColumnType("boolean") + .HasAnnotation("Relational:JsonPropertyName", "supportsLevelVoting"); + + b.Property("SupportsMobile") + .HasColumnType("boolean") + .HasAnnotation("Relational:JsonPropertyName", "supportsMobile"); + + b.Property("SupportsQuest2") + .HasColumnType("boolean") + .HasAnnotation("Relational:JsonPropertyName", "supportsQuest2"); + + b.Property("SupportsScreens") + .HasColumnType("boolean") + .HasAnnotation("Relational:JsonPropertyName", "supportsScreens"); + + b.Property("SupportsTeleportVR") + .HasColumnType("boolean") + .HasAnnotation("Relational:JsonPropertyName", "supportsTeleportVR"); + + b.Property("SupportsVRLow") + .HasColumnType("boolean") + .HasAnnotation("Relational:JsonPropertyName", "supportsVRLow"); + + b.Property("SupportsWalkVR") + .HasColumnType("boolean") + .HasAnnotation("Relational:JsonPropertyName", "supportsWalkVR"); + + b.Property("Tags") + .IsRequired() + .HasColumnType("text") + .HasAnnotation("Relational:JsonPropertyName", "tags"); + + b.Property("WarningMask") + .HasColumnType("integer") + .HasAnnotation("Relational:JsonPropertyName", "warningMask"); + + b.HasKey("Id"); + + b.HasIndex("CreatorAccountId"); + + b.ToTable("rooms", (string)null); + }); + + modelBuilder.Entity("CannedNet.RoomInstance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EncryptVoiceChat") + .HasColumnType("boolean") + .HasAnnotation("Relational:JsonPropertyName", "EncryptVoiceChat"); + + b.Property("OwnerAccountId") + .HasColumnType("integer"); + + b.Property("clubId") + .HasColumnType("integer") + .HasAnnotation("Relational:JsonPropertyName", "clubId"); + + b.Property("dataBlob") + .IsRequired() + .HasColumnType("text") + .HasAnnotation("Relational:JsonPropertyName", "dataBlob"); + + b.Property("eventId") + .HasColumnType("integer") + .HasAnnotation("Relational:JsonPropertyName", "eventId"); + + b.Property("isFull") + .HasColumnType("boolean") + .HasAnnotation("Relational:JsonPropertyName", "isFull"); + + b.Property("isInProgress") + .HasColumnType("boolean") + .HasAnnotation("Relational:JsonPropertyName", "isInProgress"); + + b.Property("isPrivate") + .HasColumnType("boolean") + .HasAnnotation("Relational:JsonPropertyName", "isPrivate"); + + b.Property("location") + .IsRequired() + .HasColumnType("text") + .HasAnnotation("Relational:JsonPropertyName", "location"); + + b.Property("maxCapacity") + .HasColumnType("integer") + .HasAnnotation("Relational:JsonPropertyName", "maxCapacity"); + + b.Property("name") + .IsRequired() + .HasColumnType("text") + .HasAnnotation("Relational:JsonPropertyName", "name"); + + b.Property("photonRegionId") + .IsRequired() + .HasColumnType("text") + .HasAnnotation("Relational:JsonPropertyName", "photonRegionId"); + + b.Property("photonRoomId") + .IsRequired() + .HasColumnType("text") + .HasAnnotation("Relational:JsonPropertyName", "photonRoomId"); + + b.Property("roomCode") + .IsRequired() + .HasColumnType("text") + .HasAnnotation("Relational:JsonPropertyName", "roomCode"); + + b.Property("roomId") + .HasColumnType("integer") + .HasAnnotation("Relational:JsonPropertyName", "roomId"); + + b.Property("roomInstanceId") + .HasColumnType("integer") + .HasAnnotation("Relational:JsonPropertyName", "roomInstanceId"); + + b.Property("roomInstanceType") + .HasColumnType("integer") + .HasAnnotation("Relational:JsonPropertyName", "roomInstanceType"); + + b.Property("subRoomId") + .HasColumnType("integer") + .HasAnnotation("Relational:JsonPropertyName", "subRoomId"); + + b.HasKey("Id"); + + b.HasIndex("OwnerAccountId", "roomId"); + + b.ToTable("room_instances", (string)null); + }); + + modelBuilder.Entity("CannedNet.RoomRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("integer") + .HasAnnotation("Relational:JsonPropertyName", "accountId"); + + b.Property("InvitedRole") + .HasColumnType("integer") + .HasAnnotation("Relational:JsonPropertyName", "invitedRole"); + + b.Property("Role") + .HasColumnType("integer") + .HasAnnotation("Relational:JsonPropertyName", "role"); + + b.Property("RoomId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("RoomId"); + + b.ToTable("room_roles", (string)null); + }); + + modelBuilder.Entity("CannedNet.SavedOutfit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FaceFeatures") + .IsRequired() + .HasColumnType("text") + .HasAnnotation("Relational:JsonPropertyName", "FaceFeatures"); + + b.Property("HairColor") + .IsRequired() + .HasColumnType("text") + .HasAnnotation("Relational:JsonPropertyName", "HairColor"); + + b.Property("OutfitSelections") + .IsRequired() + .HasColumnType("text") + .HasAnnotation("Relational:JsonPropertyName", "OutfitSelections"); + + b.Property("OwnerAccountId") + .HasColumnType("integer"); + + b.Property("PreviewImageName") + .IsRequired() + .HasColumnType("text") + .HasAnnotation("Relational:JsonPropertyName", "PreviewImageName"); + + b.Property("SkinColor") + .IsRequired() + .HasColumnType("text") + .HasAnnotation("Relational:JsonPropertyName", "SkinColor"); + + b.Property("Slot") + .HasColumnType("integer") + .HasAnnotation("Relational:JsonPropertyName", "Slot"); + + b.HasKey("Id"); + + b.HasIndex("OwnerAccountId") + .IsUnique(); + + b.ToTable("saved_outfits", (string)null); + }); + + modelBuilder.Entity("CannedNet.SubRoom", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Accessibility") + .HasColumnType("integer") + .HasAnnotation("Relational:JsonPropertyName", "accessibility"); + + b.Property("DataBlob") + .IsRequired() + .HasColumnType("text") + .HasAnnotation("Relational:JsonPropertyName", "dataBlob"); + + b.Property("DataSavedAt") + .HasColumnType("timestamp with time zone") + .HasAnnotation("Relational:JsonPropertyName", "dataSavedAt"); + + b.Property("IsSandbox") + .HasColumnType("boolean") + .HasAnnotation("Relational:JsonPropertyName", "isSandbox"); + + b.Property("MaxPlayers") + .HasColumnType("integer") + .HasAnnotation("Relational:JsonPropertyName", "maxPlayers"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasAnnotation("Relational:JsonPropertyName", "name"); + + b.Property("RoomId") + .HasColumnType("integer"); + + b.Property("SubRoomId") + .HasColumnType("integer") + .HasAnnotation("Relational:JsonPropertyName", "subRoomId"); + + b.Property("UnitySceneId") + .IsRequired() + .HasColumnType("text") + .HasAnnotation("Relational:JsonPropertyName", "unitySceneId"); + + b.HasKey("Id"); + + b.HasIndex("RoomId"); + + b.ToTable("sub_rooms", (string)null); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/CannedNet/Migrations/20260404002057_RemoveUniqueOwnerAccountId.cs b/CannedNet/Migrations/20260404002057_RemoveUniqueOwnerAccountId.cs new file mode 100644 index 0000000..9d2f9a9 --- /dev/null +++ b/CannedNet/Migrations/20260404002057_RemoveUniqueOwnerAccountId.cs @@ -0,0 +1,37 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace CannedNet.Migrations +{ + /// + public partial class RemoveUniqueOwnerAccountId : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "IX_room_instances_OwnerAccountId", + table: "room_instances"); + + migrationBuilder.CreateIndex( + name: "IX_room_instances_OwnerAccountId_roomId", + table: "room_instances", + columns: new[] { "OwnerAccountId", "roomId" }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "IX_room_instances_OwnerAccountId_roomId", + table: "room_instances"); + + migrationBuilder.CreateIndex( + name: "IX_room_instances_OwnerAccountId", + table: "room_instances", + column: "OwnerAccountId", + unique: true); + } + } +} diff --git a/CannedNet/Migrations/AppDbContextModelSnapshot.cs b/CannedNet/Migrations/AppDbContextModelSnapshot.cs index 2b135b4..63ad75e 100644 --- a/CannedNet/Migrations/AppDbContextModelSnapshot.cs +++ b/CannedNet/Migrations/AppDbContextModelSnapshot.cs @@ -549,8 +549,7 @@ namespace CannedNet.Migrations b.HasKey("Id"); - b.HasIndex("OwnerAccountId") - .IsUnique(); + b.HasIndex("OwnerAccountId", "roomId"); b.ToTable("room_instances", (string)null); }); diff --git a/CannedNet/Services/APIService.cs b/CannedNet/Services/APIService.cs index 162d0b5..62def2c 100644 --- a/CannedNet/Services/APIService.cs +++ b/CannedNet/Services/APIService.cs @@ -712,31 +712,23 @@ public class APIService if (room == null) return Results.NotFound(); - var include = request.Query["include"].FirstOrDefault() ?? ""; - - bool includeSubRooms = include.Contains("subRooms", StringComparison.OrdinalIgnoreCase); - bool includeRoles = include.Contains("roles", StringComparison.OrdinalIgnoreCase); - bool includeLoadScreens = include.Contains("loadScreens", StringComparison.OrdinalIgnoreCase); - bool includePromoImages = include.Contains("promoImages", StringComparison.OrdinalIgnoreCase); - bool includeExternal = include.Contains("promoExternalContent", StringComparison.OrdinalIgnoreCase); - - var subRooms = includeSubRooms + var subRooms = true ? await db.SubRooms.Where(x => x.RoomId == room.RoomId).ToListAsync() : new List(); - var roles = includeRoles + var roles = true ? await db.RoomRoles.Where(x => x.RoomId == room.RoomId).ToListAsync() : new List(); - var loadScreens = includeLoadScreens + var loadScreens = true ? await db.LoadScreens.Where(x => x.RoomId == room.RoomId).ToListAsync() : new List(); - var promoImages = includePromoImages + var promoImages = true ? await db.PromoImages.Where(x => x.RoomId == room.RoomId).ToListAsync() : new List(); - var external = includeExternal + var external = true ? await db.PromoExternalContents.Where(x => x.RoomId == room.RoomId).ToListAsync() : new List(); @@ -784,6 +776,7 @@ public class APIService SubRooms = subRooms.Select(s => new { s.SubRoomId, + s.RoomId, s.Name, s.DataBlob, s.IsSandbox, diff --git a/CannedNet/Services/CommerceService.cs b/CannedNet/Services/CommerceService.cs index 9c84822..66fe2e2 100644 --- a/CannedNet/Services/CommerceService.cs +++ b/CannedNet/Services/CommerceService.cs @@ -8,7 +8,7 @@ public class CommerceService { app.MapGet("/purchase/v1/hasspentmoney", (HttpRequest request) => { - return "true"; + return Results.NotFound(); }); } } \ No newline at end of file diff --git a/CannedNet/Services/MatchmakingService.cs b/CannedNet/Services/MatchmakingService.cs index 385a8e9..da6b31c 100644 --- a/CannedNet/Services/MatchmakingService.cs +++ b/CannedNet/Services/MatchmakingService.cs @@ -72,18 +72,6 @@ public class MatchmakingService roomData = await db.Rooms.FirstOrDefaultAsync(r => r.Name.ToLower() == roomLower); } - if (roomData == null && roomLower == "dormroom") - { - roomData = new Room - { - RoomId = 1, - Name = "DormRoom", - Description = "Your private room", - CreatorAccountId = id, - EncryptVoiceChat = false - }; - } - if (roomData == null) { return Results.NotFound("Room not found"); @@ -95,16 +83,6 @@ public class MatchmakingService int subRoomId = subRoom?.SubRoomId ?? 0; int maxCapacity = subRoom?.MaxPlayers ?? 4; - if (string.IsNullOrEmpty(location)) - { - location = "76d98498-60a1-430c-ab76-b54a29b7a163"; - } - - if (subRoomId == 0) - { - subRoomId = 1; - } - var publicInstance = await db.RoomInstances .FirstOrDefaultAsync(r => r.roomId == roomData.RoomId && !r.isPrivate && !r.isFull); @@ -155,7 +133,7 @@ public class MatchmakingService name = roomData.Name, maxCapacity = maxCapacity, isFull = false, - isPrivate = false, + isPrivate = roomData.RoomId == 1, isInProgress = false, EncryptVoiceChat = roomData.EncryptVoiceChat }; @@ -189,13 +167,11 @@ public class MatchmakingService name = instanceToUse?.name ?? roomData.Name, maxCapacity = instanceToUse?.maxCapacity ?? maxCapacity, isFull = instanceToUse?.isFull ?? false, - isPrivate = instanceToUse?.isPrivate ?? false, + isPrivate = roomData.RoomId == 1 ? true : (instanceToUse?.isPrivate ?? false), isInProgress = instanceToUse?.isInProgress ?? false, EncryptVoiceChat = instanceToUse?.EncryptVoiceChat ?? roomData.EncryptVoiceChat } }; - - Console.WriteLine($"[DEBUG] Full response: {System.Text.Json.JsonSerializer.Serialize(response)}"); return Results.Json(response); }); @@ -263,7 +239,10 @@ public class MatchmakingService if (heartbeat == null) heartbeat = new HeartbeatRequest(); - var roomInstance = await db.RoomInstances.FirstOrDefaultAsync(r => r.OwnerAccountId == id); + var roomInstance = await db.RoomInstances + .Where(r => r.OwnerAccountId == id) + .OrderByDescending(r => r.Id) + .FirstOrDefaultAsync(); return Results.Json(new { @@ -291,7 +270,7 @@ public class MatchmakingService isInProgress = roomInstance.isInProgress, EncryptVoiceChat = roomInstance.EncryptVoiceChat } : null, - isOnline = true, + isOnline = roomInstance != null && roomInstance.roomId != 1, appVersion = heartbeat.appVersion ?? "", platform = heartbeat.platform }); @@ -301,15 +280,8 @@ public class MatchmakingService // TODO ADD FUNCTIONALITY return Results.Ok(); }); - app.MapPut("/roominstance/{id}/reportjoinresult", async (HttpRequest request, AppDbContext db) => + app.MapPost("/roominstance/{id}/reportjoinresult", async (HttpRequest request, AppDbContext db) => { - request.EnableBuffering(); - request.Body.Position = 0; - using var reader = new StreamReader(request.Body); - var body = await reader.ReadToEndAsync(); - - Console.WriteLine($"[DEBUG] reportjoinresult body: {body}"); - return Results.Ok(); }); }