like.go 1.4 KB
Newer Older
zauberstuhl's avatar
zauberstuhl committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
package controllers
//
// GangGo Application Server
// Copyright (C) 2017 Lukas Matt <lukas@zauberstuhl.de>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
//

import (
  "net/http"
  "github.com/revel/revel"
23
  "gopkg.in/ganggo/ganggo.v0/app/models"
zauberstuhl's avatar
zauberstuhl committed
24 25
)

26
type ApiLike struct {
zauberstuhl's avatar
zauberstuhl committed
27 28 29
  *revel.Controller
}

30
func (l ApiLike) Index() revel.Result {
zauberstuhl's avatar
zauberstuhl committed
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
  var (
    postID uint
    likes models.Likes
  )

  l.Params.Bind(&postID, "id")
  err := likes.FindByPostID(postID)
  if err != nil {
    l.Response.Status = http.StatusInternalServerError
    revel.ERROR.Println(err)
  }

  return l.RenderJson(likes)
}

46
func (l ApiLike) Create() revel.Result {
47
  return l.NotFound("Not implemented yet")
zauberstuhl's avatar
zauberstuhl committed
48 49
}

50
func (l ApiLike) Show() revel.Result {
51
  return l.NotFound("Not implemented yet")
zauberstuhl's avatar
zauberstuhl committed
52 53
}

54
func (l ApiLike) Delete() revel.Result {
55
  return l.NotFound("Not implemented yet")
zauberstuhl's avatar
zauberstuhl committed
56
}