mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-06 20:08:40 +00:00
Fix photo deserialization/serialization
This commit is contained in:
parent
632e430b36
commit
0ffd01f59d
2 changed files with 8 additions and 2 deletions
|
@ -40,7 +40,7 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
|||
photo.CreatorId = user.UserId;
|
||||
photo.Creator = user;
|
||||
|
||||
foreach (PhotoSubject subject in photo.Subjects)
|
||||
foreach (PhotoSubject subject in photo.SubjectsXmlDontUse) // fine for here
|
||||
{
|
||||
subject.User = await this.database.Users.FirstOrDefaultAsync(u => u.Username == subject.Username);
|
||||
|
||||
|
|
|
@ -33,17 +33,23 @@ namespace LBPUnion.ProjectLighthouse.Types
|
|||
[XmlElement("plan")]
|
||||
public string PlanHash { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
private List<PhotoSubject>? subjects;
|
||||
|
||||
[NotMapped]
|
||||
[XmlArray("subjects")]
|
||||
[XmlArrayItem("subject")]
|
||||
public List<PhotoSubject> SubjectsXmlDontUse {
|
||||
get => null!;
|
||||
set => Subjects = value;
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public List<PhotoSubject> Subjects {
|
||||
get {
|
||||
if (this.subjects != null) return this.subjects;
|
||||
|
||||
List<PhotoSubject> response = new();
|
||||
|
||||
using Database database = new();
|
||||
|
||||
foreach (string idStr in this.PhotoSubjectIds)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue