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
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:
parent
bca8e3374a
commit
aa99788268
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user