Commit 371711e1 authored by zauberstuhl's avatar zauberstuhl

Remove back-end function Post.FindByID from API

parent 1a762415
......@@ -150,9 +150,8 @@ func (c ApiComment) Create() revel.Result {
return c.ApiError(http.StatusBadRequest, ERR_EMPTY_STRING)
}
err := post.FindByID(postID)
if err != nil {
c.Log.Error(TAG, "db", err, "api", ERR_NOT_FOUND)
if !post.Exists(postID) {
c.Log.Error(TAG, "api", ERR_NOT_FOUND)
return c.ApiError(http.StatusNotFound, ERR_NOT_FOUND)
}
......
......@@ -169,7 +169,7 @@ func (l ApiLike) Create() revel.Result {
l.Params.Bind(&postID, "id")
l.Params.Bind(&positive, "positive")
err := post.FindByID(postID)
err := post.FindByIDAndUser(postID, l.CurrentUser)
if err != nil {
l.Log.Error(TAG, "db", err, "api", ERR_NOT_FOUND)
return l.ApiError(http.StatusNotFound, ERR_NOT_FOUND)
......
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