Commit 51ce612b authored by zauberstuhl's avatar zauberstuhl

Implement notification update call

parent 3170b034
......@@ -51,6 +51,23 @@ func (n ApiNotification) Show() revel.Result {
return n.NotFound("Not implemented yet")
}
func (n ApiNotification) Delete() revel.Result {
return n.NotFound("Not implemented yet")
func (n ApiNotification) Update(id uint) revel.Result {
user, err := models.GetCurrentUser(n.Session["TOKEN"])
if err != nil {
revel.AppLog.Error(err.Error())
return n.RenderError(err)
}
notify := models.Notification{
ID: id,
UserID: user.ID,
Unread: false,
}
err = notify.Update()
if err != nil {
revel.AppLog.Error(err.Error())
return n.RenderError(err)
}
return n.RenderJSON(notify)
}
......@@ -8,7 +8,7 @@ DELETE /api/v0/posts/:id ApiPost.Delete
GET /api/v0/notifications ApiNotification.Index
POST /api/v0/notifications ApiNotification.Create
GET /api/v0/notifications/:id ApiNotification.Show
DELETE /api/v0/notifications/:id ApiNotification.Delete
PUT /api/v0/notifications/:id ApiNotification.Update
GET /api/v0/posts/:id/likes ApiLike.Index
POST /api/v0/posts/:id/likes/:positive ApiLike.Create
......
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