mirror of
https://github.com/streetwriters/notesnook-sync-server.git
synced 2026-02-12 19:22:45 +00:00
monographs: add stats endpoint (#69)
* also don't mark monograph for sync when tracking view count
This commit is contained in:
@@ -267,13 +267,25 @@ namespace Notesnook.API.Controllers
|
||||
Expires = DateTimeOffset.UtcNow.AddMonths(1)
|
||||
};
|
||||
Response.Cookies.Append(cookieName, "1", cookieOptions);
|
||||
|
||||
await MarkMonographForSyncAsync(monograph.UserId, id);
|
||||
}
|
||||
|
||||
return Content(SVG_PIXEL, "image/svg+xml");
|
||||
}
|
||||
|
||||
[HttpGet("{id}/stats")]
|
||||
public async Task<IActionResult> GetMonographStatsAsync([FromRoute] string id)
|
||||
{
|
||||
var userId = this.User.GetUserId();
|
||||
var monograph = await FindMonographAsync(id);
|
||||
|
||||
if (monograph == null || monograph.Deleted || monograph.UserId != userId)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(new { viewCount = monograph.ViewCount });
|
||||
}
|
||||
|
||||
[HttpDelete("{id}")]
|
||||
public async Task<IActionResult> DeleteAsync([FromQuery] string? deviceId, [FromRoute] string id)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user