people.go 1.39 KB
Newer Older
zauberstuhl's avatar
zauberstuhl committed
1 2
package controllers
//
zauberstuhl's avatar
zauberstuhl committed
3
// GangGo API Library
zauberstuhl's avatar
zauberstuhl committed
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
// 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 (
  "github.com/revel/revel"
22
  "gopkg.in/ganggo/ganggo.v0/app/models"
zauberstuhl's avatar
zauberstuhl committed
23 24
)

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

29
func (p ApiPeople) Index() revel.Result {
30
  return p.NotFound("Not implemented yet")
zauberstuhl's avatar
zauberstuhl committed
31 32
}

33
func (p ApiPeople) Create() revel.Result {
34
  return p.NotFound("Not implemented yet")
zauberstuhl's avatar
zauberstuhl committed
35 36
}

37 38 39 40 41 42 43 44 45 46 47 48 49 50
func (p ApiPeople) Show() revel.Result {
  var (
    personID uint
    person models.Person
  )

  p.Params.Bind(&personID, "id")
  err := person.FindByID(personID)
  if err != nil {
    revel.ERROR.Println(err)
    return p.NotFound("Person not found")
  }

  return p.RenderJson(person)
zauberstuhl's avatar
zauberstuhl committed
51 52
}

53
func (p ApiPeople) Delete() revel.Result {
54
  return p.NotFound("Not implemented yet")
zauberstuhl's avatar
zauberstuhl committed
55
}