🐛 Fix bugs on relationship api

This commit is contained in:
LittleSheep 2025-06-20 01:26:30 +08:00
parent 27276c66c5
commit 700c818df8

View File

@ -32,7 +32,7 @@ public class RelationshipController(AppDatabase db, RelationshipService rels) :
var statuses = await db.AccountRelationships var statuses = await db.AccountRelationships
.Where(r => r.AccountId == userId) .Where(r => r.AccountId == userId)
.ToDictionaryAsync(r => r.AccountId); .ToDictionaryAsync(r => r.RelatedId);
foreach (var relationship in relationships) foreach (var relationship in relationships)
if (statuses.TryGetValue(relationship.RelatedId, out var status)) if (statuses.TryGetValue(relationship.RelatedId, out var status))
relationship.Status = status.Status; relationship.Status = status.Status;