🐛 Trying to fix the wrong relationship fetch

This commit is contained in:
2025-12-23 23:56:24 +08:00
parent 3c023a71b1
commit 5ff1539f18
2 changed files with 21 additions and 13 deletions

View File

@@ -35,8 +35,9 @@ public class RelationshipController(AppDatabase db, RelationshipService rels) :
.Where(r => r.AccountId == userId)
.ToDictionaryAsync(r => r.RelatedId);
foreach (var relationship in relationships)
if (statuses.TryGetValue(relationship.RelatedId, out var status))
relationship.Status = status.Status;
relationship.Status = statuses.TryGetValue(relationship.AccountId, out var status)
? status.Status
: RelationshipStatus.Pending;
Response.Headers["X-Total"] = totalCount.ToString();