mirror of
https://github.com/streetwriters/notesnook-sync-server.git
synced 2026-02-12 11:12:44 +00:00
sync: improve announcements & monograph query performance
This commit is contained in:
@@ -42,10 +42,8 @@ namespace Notesnook.API.Controllers
|
||||
[AllowAnonymous]
|
||||
public async Task<IActionResult> GetActiveAnnouncements([FromQuery] string userId)
|
||||
{
|
||||
var announcements = await Announcements.FindAsync((a) => a.IsActive);
|
||||
return Ok(announcements.Where((a) => a.UserIds != null && a.UserIds.Length > 0
|
||||
? a.UserIds.Contains(userId)
|
||||
: true));
|
||||
var announcements = await Announcements.FindAsync((a) => a.IsActive && (a.UserIds == null || a.UserIds.Length == 0 || a.UserIds.Contains(userId)));
|
||||
return Ok(announcements);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace Notesnook.API.Controllers
|
||||
[AllowAnonymous]
|
||||
public async Task<IActionResult> GetMonographAsync([FromRoute] string id)
|
||||
{
|
||||
var monograph = await Monographs.FindOneAsync((m) => m.Id == id);
|
||||
var monograph = await Monographs.GetAsync(id);
|
||||
if (monograph == null)
|
||||
{
|
||||
return NotFound(new
|
||||
|
||||
Reference in New Issue
Block a user