Commit 519cbf51 authored by zauberstuhl's avatar zauberstuhl

Display all notifications read/unread

add optional offset parameter (default limit is 10)
parent a26d6484
......@@ -40,6 +40,7 @@ type ApiNotification struct {
* @apiGroup Notifications
*
* @apiParam {String} access_token Oauth access token
* @apiParam {Number} [offset] Post offset for database
*
* @apiSuccess {String} CreatedAt Timestamp of creation
* @apiSuccess {String} UpdatedAt Timestamp of last replacment
......@@ -80,7 +81,7 @@ type ApiNotification struct {
* }
*
*/
func (n ApiNotification) Index() revel.Result {
func (n ApiNotification) Index(offset int) revel.Result {
user, err := models.CurrentUser(n.Params, n.Session)
if err != nil {
n.Log.Error(TAG, "db", err, "api", ERR_UNAUTHORIZED)
......@@ -88,7 +89,7 @@ func (n ApiNotification) Index() revel.Result {
}
var notify models.Notifications
err = notify.FindUnreadByUserID(user.ID)
err = notify.FindByUserID(user.ID, offset)
if err != nil {
n.Log.Error(TAG, "db", err, "api", ERR_SERVER)
return n.ApiError(http.StatusInternalServerError, ERR_SERVER)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment