🐛 Fix migrate has no value

This commit is contained in:
LittleSheep 2025-06-02 20:52:03 +08:00
parent 2691c5d9ac
commit 5487b4e607

View File

@ -43,7 +43,8 @@ public class FileReferenceMigrationService(AppDatabase db)
.ToDictionary(g => g.Key, g => g.ToList());
var fileReferences = posts.SelectMany(post =>
attachmentsDict[post.Id].Select(attachment =>
attachmentsDict.TryGetValue(post.Id, out var value)
? value.Select(attachment =>
new CloudFileReference
{
FileId = attachment.Id,
@ -53,6 +54,7 @@ public class FileReferenceMigrationService(AppDatabase db)
CreatedAt = SystemClock.Instance.GetCurrentInstant(),
UpdatedAt = SystemClock.Instance.GetCurrentInstant()
})
: []
)
.ToList();