Having the clear locations endpoint only clear world locations, and adding endpoint to remove all items
This commit is contained in:
@@ -31,6 +31,17 @@ public class LocationService
|
||||
|
||||
public virtual async Task DeleteAsync(string id) =>
|
||||
await _locations.DeleteOneAsync(loc => loc.Id == id);
|
||||
|
||||
public virtual async Task<List<Location>> GetByTypeAsync(string type)
|
||||
{
|
||||
return await _locations.Find(l => l.LocationType == type).ToListAsync();
|
||||
}
|
||||
|
||||
public virtual async Task DeleteByTypeAsync(string type) =>
|
||||
await _locations.DeleteManyAsync(l => l.LocationType == type);
|
||||
|
||||
public virtual async Task DeleteAllAsync() =>
|
||||
await _locations.DeleteManyAsync(_ => true);
|
||||
public virtual async Task UpdateAsync(Location loc) =>
|
||||
await _locations.ReplaceOneAsync(l => l.Id == loc.Id, loc);
|
||||
|
||||
@@ -83,4 +94,10 @@ public class LocationService
|
||||
var update = Builders<Location>.Update.Pull(l => l.Content, itemId);
|
||||
await _locations.UpdateOneAsync(filter, update);
|
||||
}
|
||||
|
||||
public virtual async Task ClearAllItemsAsync()
|
||||
{
|
||||
var update = Builders<Location>.Update.Set(l => l.Content, new List<string>());
|
||||
await _locations.UpdateManyAsync(_ => true, update);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user