Add pagination for API GetNotifications (#3145)

This commit is contained in:
Samuel Adams
2021-11-26 04:55:59 +02:00
committed by GitHub
parent 57852821f5
commit 9b730e784f
4 changed files with 41 additions and 12 deletions

View File

@@ -33,11 +33,11 @@ namespace BTCPayServer.Controllers.GreenField
[Authorize(Policy = Policies.CanViewNotificationsForUser,
AuthenticationSchemes = AuthenticationSchemes.Greenfield)]
[HttpGet("~/api/v1/users/me/notifications")]
public async Task<IActionResult> GetNotifications(bool? seen = null)
public async Task<IActionResult> GetNotifications(bool? seen = null, [FromQuery] int? skip = null, [FromQuery] int? take = null)
{
var items = await _notificationManager.GetNotifications(new NotificationsQuery()
{
Seen = seen, UserId = _userManager.GetUserId(User)
Seen = seen, UserId = _userManager.GetUserId(User), Skip = skip, Take = take
});
return Ok(items.Items.Select(ToModel));