Fix score, photo, and comment activities

This commit is contained in:
Slendy 2023-09-05 22:51:01 -05:00
commit 0c9c8fd7b2
No known key found for this signature in database
GPG key ID: 7288D68361B91428
2 changed files with 27 additions and 7 deletions

View file

@ -196,6 +196,7 @@ public class ActivityEventHandlerTests
HeartedLevelId = 1,
UserId = 1,
SlotId = 1,
Slot = slot,
};
eventHandler.OnEntityInserted(database, heartedLevel);

View file

@ -35,25 +35,44 @@ public class ActivityEntityEventHandler : IEntityEventHandler
},
_ => null,
},
CommentEntity comment => comment.TargetSlot?.Type switch
CommentEntity comment => comment.Type switch
{
SlotType.User => new CommentActivityEntity
CommentType.Level => comment.TargetSlot?.Type switch
{
Type = comment.Type == CommentType.Level ? EventType.CommentOnLevel : EventType.CommentOnUser,
SlotType.User => new CommentActivityEntity
{
Type = EventType.CommentOnLevel,
CommentId = comment.CommentId,
UserId = comment.PosterUserId,
},
_ => null,
},
CommentType.Profile => new CommentActivityEntity
{
Type = EventType.CommentOnUser,
CommentId = comment.CommentId,
UserId = comment.PosterUserId,
},
},
_ => null,
},
PhotoEntity photo => photo.Slot?.Type switch
PhotoEntity photo => photo.SlotId switch
{
SlotType.User => new PhotoActivityEntity
null => new PhotoActivityEntity
{
Type = EventType.UploadPhoto,
PhotoId = photo.PhotoId,
UserId = photo.CreatorId,
},
_ => null,
_ => photo.Slot?.Type switch
{
SlotType.User => new PhotoActivityEntity
{
Type = EventType.UploadPhoto,
PhotoId = photo.PhotoId,
UserId = photo.CreatorId,
},
_ => null,
},
},
ScoreEntity score => score.Slot.Type switch
{