From 96e96d948d226398df8c9e9662afe6ea47d262cf Mon Sep 17 00:00:00 2001 From: Jimmy Zelinskie Date: Mon, 1 Feb 2016 19:22:04 -0500 Subject: [PATCH] api: handle last page for notifications --- api/v1/models.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/api/v1/models.go b/api/v1/models.go index d032fb5b..5d41cbaa 100644 --- a/api/v1/models.go +++ b/api/v1/models.go @@ -172,6 +172,11 @@ func NotificationFromDatabaseModel(dbNotification database.VulnerabilityNotifica *oldVuln = VulnerabilityWithLayersFromDatabaseModel(*dbNotification.OldVulnerability) } + var nextPageStr string + if nextPage != database.NoVulnerabilityNotificationPage { + nextPageStr = DBPageNumberToString(nextPage) + } + // TODO(jzelinskie): implement "changed" key return Notification{ Name: dbNotification.Name, @@ -180,7 +185,7 @@ func NotificationFromDatabaseModel(dbNotification database.VulnerabilityNotifica Deleted: fmt.Sprintf("%d", dbNotification.Deleted.Unix()), Limit: limit, Page: DBPageNumberToString(page), - NextPage: DBPageNumberToString(nextPage), + NextPage: nextPageStr, Old: oldVuln, New: VulnerabilityWithLayersFromDatabaseModel(dbNotification.NewVulnerability), }