Fixing BSON projection
All checks were successful
Deploy Promiscuity Auth API / deploy (push) Successful in 47s
Deploy Promiscuity Character API / deploy (push) Successful in 1m1s
Deploy Promiscuity Inventory API / deploy (push) Successful in 46s
Deploy Promiscuity Locations API / deploy (push) Successful in 47s
k8s smoke test / test (push) Successful in 9s

This commit is contained in:
Zeeshaun 2026-03-23 18:45:52 -05:00
parent bca8e3374a
commit aa99788268

View File

@ -47,23 +47,26 @@ public class CharacterStore
return result.ModifiedCount > 0 || result.MatchedCount > 0;
}
public Task<List<VisibleCharacter>> GetVisibleOthersAsync(string characterId, int x, int y, int radius, DateTime onlineSinceUtc) =>
_col.Find(c =>
public async Task<List<VisibleCharacter>> GetVisibleOthersAsync(string characterId, int x, int y, int radius, DateTime onlineSinceUtc)
{
var characters = await _col.Find(c =>
c.Id != characterId &&
c.Coord.X >= x - radius &&
c.Coord.X <= x + radius &&
c.Coord.Y >= y - radius &&
c.Coord.Y <= y + radius &&
c.LastSeenUtc >= onlineSinceUtc)
.Project(c => new VisibleCharacter
{
Id = c.Id ?? string.Empty,
Name = c.Name,
Coord = c.Coord,
LastSeenUtc = c.LastSeenUtc
})
.ToListAsync();
return characters.Select(c => new VisibleCharacter
{
Id = c.Id ?? string.Empty,
Name = c.Name,
Coord = c.Coord,
LastSeenUtc = c.LastSeenUtc
}).ToList();
}
public async Task<bool> DeleteForOwnerAsync(string id, string ownerUserId, bool allowAnyOwner)
{
var filter = Builders<Character>.Filter.Eq(c => c.Id, id);