-
Notifications
You must be signed in to change notification settings - Fork 1
/
users.go
42 lines (34 loc) · 790 Bytes
/
users.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package controllers
import (
"github.com/revel/revel"
"github.com/MaxwellPayne/revel-apikit"
"github.com/MaxwellPayne/revel-apikit/example/app/models"
)
// Controller for Users
type UserController struct {
*revel.Controller
apikit.GenericRESTController
}
// Implementation of ModelProvider interface
func (c *UserController) ModelFactory() apikit.RESTObject {
return &models.User{}
}
func (c *UserController) GetModelByID(id uint64) apikit.RESTObject {
if u := models.GetUserByID(id); u == nil {
return nil
} else {
return u
}
}
func (c *UserController) EnableGET() bool {
return true
}
func (c *UserController) EnablePOST() bool {
return true
}
func (c *UserController) EnablePUT() bool {
return true
}
func (c *UserController) EnableDELETE() bool {
return true
}