diff --git a/ProjectLighthouse/Extensions/ActivityQueryExtensions.cs b/ProjectLighthouse/Extensions/ActivityQueryExtensions.cs index e2b1363d..132ad0dc 100644 --- a/ProjectLighthouse/Extensions/ActivityQueryExtensions.cs +++ b/ProjectLighthouse/Extensions/ActivityQueryExtensions.cs @@ -82,7 +82,7 @@ public static class ActivityQueryExtensions : a is PhotoActivityEntity && ((PhotoActivityEntity)a).Photo.PhotoId != 0 ? ((PhotoActivityEntity)a).Photo.SlotId : a is CommentActivityEntity && ((CommentActivityEntity)a).Comment.Type == CommentType.Level - ? ((CommentActivityEntity)a).Comment.TargetId + ? ((CommentActivityEntity)a).Comment.TargetSlotId : a is ScoreActivityEntity ? ((ScoreActivityEntity)a).Score.SlotId : a is ReviewActivityEntity @@ -92,7 +92,7 @@ public static class ActivityQueryExtensions TargetUserId = a is UserActivityEntity ? ((UserActivityEntity)a).TargetUserId : a is CommentActivityEntity && ((CommentActivityEntity)a).Comment.Type == CommentType.Profile - ? ((CommentActivityEntity)a).Comment.TargetId + ? ((CommentActivityEntity)a).Comment.TargetUserId : a is PhotoActivityEntity && ((PhotoActivityEntity)a).Photo.SlotId != 0 ? ((PhotoActivityEntity)a).Photo.CreatorId : 0, @@ -109,7 +109,7 @@ public static class ActivityQueryExtensions : a is PhotoActivityEntity && ((PhotoActivityEntity)a).Photo.SlotId != 0 ? ((PhotoActivityEntity)a).Photo.Slot!.CreatorId : a is CommentActivityEntity && ((CommentActivityEntity)a).Comment.Type == CommentType.Level - ? ((CommentActivityEntity)a).Comment.TargetId + ? ((CommentActivityEntity)a).Comment.TargetSlot.CreatorId : a is ScoreActivityEntity ? ((ScoreActivityEntity)a).Score.Slot.CreatorId : a is ReviewActivityEntity diff --git a/ProjectLighthouse/Types/Activity/ActivityEntityEventHandler.cs b/ProjectLighthouse/Types/Activity/ActivityEntityEventHandler.cs index 76d84e99..aa3bb5ab 100644 --- a/ProjectLighthouse/Types/Activity/ActivityEntityEventHandler.cs +++ b/ProjectLighthouse/Types/Activity/ActivityEntityEventHandler.cs @@ -1,8 +1,6 @@ #nullable enable using System; -using System.ComponentModel.DataAnnotations.Schema; using System.Linq; -using System.Reflection; using LBPUnion.ProjectLighthouse.Database; using LBPUnion.ProjectLighthouse.Types.Entities.Activity; using LBPUnion.ProjectLighthouse.Types.Entities.Interaction; @@ -44,8 +42,7 @@ public class ActivityEntityEventHandler : IEntityEventHandler { Type = EventType.Score, ScoreId = score.ScoreId, - //TODO merge score migration - UserId = database.Users.Where(u => u.Username == score.PlayerIds[0]).Select(u => u.UserId).First(), + UserId = score.UserId, }, HeartedLevelEntity heartedLevel => new LevelActivityEntity { diff --git a/ProjectLighthouse/Types/Serialization/Activity/Events/GameCommentEvent.cs b/ProjectLighthouse/Types/Serialization/Activity/Events/GameCommentEvent.cs index 93d38257..1b297785 100644 --- a/ProjectLighthouse/Types/Serialization/Activity/Events/GameCommentEvent.cs +++ b/ProjectLighthouse/Types/Serialization/Activity/Events/GameCommentEvent.cs @@ -27,7 +27,7 @@ public class GameUserCommentEvent : GameCommentEvent CommentEntity comment = await database.Comments.FindAsync(this.CommentId); if (comment == null) return; - UserEntity user = await database.Users.FindAsync(comment.TargetId); + UserEntity user = await database.Users.FindAsync(comment.TargetUserId); if (user == null) return; this.TargetUsername = user.Username; @@ -46,7 +46,7 @@ public class GameSlotCommentEvent : GameCommentEvent CommentEntity comment = await database.Comments.FindAsync(this.CommentId); if (comment == null) return; - SlotEntity slot = await database.Slots.FindAsync(comment.TargetId); + SlotEntity slot = await database.Slots.FindAsync(comment.TargetSlotId); if (slot == null) return;