diff --git a/ProjectLighthouse.Servers.GameServer/Controllers/Slots/PublishController.cs b/ProjectLighthouse.Servers.GameServer/Controllers/Slots/PublishController.cs index aad6d46a..bc220b68 100644 --- a/ProjectLighthouse.Servers.GameServer/Controllers/Slots/PublishController.cs +++ b/ProjectLighthouse.Servers.GameServer/Controllers/Slots/PublishController.cs @@ -235,7 +235,7 @@ public class PublishController : ControllerBase oldSlot.MaximumPlayers = Math.Clamp(slot.MaximumPlayers, 1, 4); await this.database.SaveChangesAsync(); - return this.Ok(SlotBase.CreateFromEntity(oldSlot, this.GetToken())); + return this.Ok(SlotBase.CreateFromEntity(oldSlot, token)); } int usedSlots = await this.database.Slots.CountAsync(s => s.CreatorId == token.UserId && s.GameVersion == slotVersion); @@ -272,7 +272,7 @@ public class PublishController : ControllerBase Logger.Success($"Successfully published level {slot.Name} (id: {slot.SlotId}) by {user.Username} (id: {user.UserId})", LogArea.Publish); - return this.Ok(SlotBase.CreateFromEntity(slotEntity, this.GetToken())); + return this.Ok(SlotBase.CreateFromEntity(slotEntity, token)); } [HttpPost("unpublish/{id:int}")] diff --git a/ProjectLighthouse.Servers.GameServer/Controllers/Slots/SearchController.cs b/ProjectLighthouse.Servers.GameServer/Controllers/Slots/SearchController.cs index a31aa0c1..dd0c5aec 100644 --- a/ProjectLighthouse.Servers.GameServer/Controllers/Slots/SearchController.cs +++ b/ProjectLighthouse.Servers.GameServer/Controllers/Slots/SearchController.cs @@ -63,7 +63,7 @@ public class SearchController : ControllerBase List slots = await dbQuery.Skip(Math.Max(0, pageStart - 1)) .Take(Math.Min(pageSize, 30)) - .Select(s => SlotBase.CreateFromEntity(s, this.GetToken())) + .Select(s => SlotBase.CreateFromEntity(s, token)) .ToListAsync(); return this.Ok(new GenericSlotResponse(keyName, slots, await dbQuery.CountAsync(), 0)); diff --git a/ProjectLighthouse.Servers.GameServer/Startup/GameServerStartup.cs b/ProjectLighthouse.Servers.GameServer/Startup/GameServerStartup.cs index 42db0d8b..cd2c9cb0 100644 --- a/ProjectLighthouse.Servers.GameServer/Startup/GameServerStartup.cs +++ b/ProjectLighthouse.Servers.GameServer/Startup/GameServerStartup.cs @@ -8,6 +8,7 @@ using LBPUnion.ProjectLighthouse.Servers.GameServer.Middlewares; using LBPUnion.ProjectLighthouse.Types.Logging; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.HttpOverrides; +using Microsoft.AspNetCore.Mvc.Formatters; namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Startup; @@ -44,6 +45,7 @@ public class GameServerStartup { options.OutputFormatters.Add(new LbpOutputFormatter()); options.OutputFormatters.Add(new JsonOutputFormatter()); + options.OutputFormatters.Add(new StringOutputFormatter()); } ); diff --git a/ProjectLighthouse/Types/Entities/Profile/UserEntity.cs b/ProjectLighthouse/Types/Entities/Profile/UserEntity.cs index f278b42f..43e3cec5 100644 --- a/ProjectLighthouse/Types/Entities/Profile/UserEntity.cs +++ b/ProjectLighthouse/Types/Entities/Profile/UserEntity.cs @@ -49,7 +49,7 @@ public class UserEntity } public UserStatus GetStatus(DatabaseContext database) => new(database, this.UserId); - public int GetHeartCount(DatabaseContext database) => database.HeartedProfiles.Count(hp => hp.HeartedProfileId == this.UserId); + public int GetHeartCount(DatabaseContext database) => database.HeartedProfiles.Count(hp => hp.HeartedUserId == this.UserId); public int GetCommentCount(DatabaseContext database) => database.Comments.Count(c => c.TargetId == this.UserId && c.Type == CommentType.Profile); public int GetUsedSlotCount(DatabaseContext database) => database.Slots.Count(s => s.CreatorId == this.UserId); public int GetUploadedPhotoCount(DatabaseContext database) => database.Photos.Count(p => p.CreatorId == this.UserId);