Set PhotoId in serialized event response

This commit is contained in:
Slendy 2023-09-05 23:46:19 -05:00
commit 991b3f7af9
No known key found for this signature in database
GPG key ID: 7288D68361B91428

View file

@ -6,6 +6,7 @@ using System.Xml.Serialization;
using LBPUnion.ProjectLighthouse.Database; using LBPUnion.ProjectLighthouse.Database;
using LBPUnion.ProjectLighthouse.Types.Entities.Level; using LBPUnion.ProjectLighthouse.Types.Entities.Level;
using LBPUnion.ProjectLighthouse.Types.Entities.Profile; using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
using LBPUnion.ProjectLighthouse.Types.Levels;
using LBPUnion.ProjectLighthouse.Types.Serialization.Review; using LBPUnion.ProjectLighthouse.Types.Serialization.Review;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
@ -34,12 +35,13 @@ public class GamePhotoUploadEvent : GameEvent
if (photo == null) return; if (photo == null) return;
this.PhotoParticipants = photo.PhotoSubjects.Select(ps => ps.User.Username).ToList(); this.PhotoParticipants = photo.PhotoSubjects.Select(ps => ps.User.Username).ToList();
this.PhotoId = photo.PhotoId;
if (photo.SlotId == null) return; if (photo.SlotId == null) return;
SlotEntity slot = await database.Slots.FindAsync(photo.SlotId); SlotEntity slot = await database.Slots.FindAsync(photo.SlotId);
if (slot == null) return; if (slot == null) return;
this.Slot = ReviewSlot.CreateFromEntity(slot); if (slot.Type == SlotType.User) this.Slot = ReviewSlot.CreateFromEntity(slot);
} }
} }