Skip to content

Commit

Permalink
move all JSON structs to proper folder
Browse files Browse the repository at this point in the history
  • Loading branch information
dmonay committed Jan 12, 2015
1 parent f5725d0 commit bec6c89
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 23 deletions.
15 changes: 15 additions & 0 deletions common/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ type TreeJson struct {
UserRole string `json:"role"`
}

type TreeNameJson struct {
TreeName string `json:"treename"`
}

type MissionJson struct {
Mission string `json:"mission"`
TreeId string `json:"treeId,omitempty"`
}

type MembersJson struct {
UpdateTree bool `json:"updateTree,omitempty"`
TreeName string `json:"treeName,omitempty"`
Expand Down Expand Up @@ -63,6 +72,12 @@ type TaskJson struct {
Priority string `json:"priority"`
}

type ObjPropertiesJson struct {
ObjName string `json:"objName",omitempty`
ObjBody string `json:"objbody",omitempty`
Completed interface{} `json:"completed",omitempty`
}

type KrPropertiesJson struct {
KrName string `json:"krName",omitempty`
KrBody string `json:"krbody",omitempty`
Expand Down
8 changes: 2 additions & 6 deletions handlers/mission_update.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
package handlers

import (
"github.com/dmonay/okra/common"
"github.com/gin-gonic/gin"
"gopkg.in/mgo.v2/bson"
)

func (dw *DoWorkResource) UpdateMission(c *gin.Context) {

type MissionJson struct {
Mission string `json:"mission"`
TreeId string `json:"treeId,omitempty"`
}

org := c.Params.ByName("organization")
var reqBody MissionJson
var reqBody common.MissionJson

c.Bind(&reqBody)

Expand Down
9 changes: 2 additions & 7 deletions handlers/objective_update_props.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package handlers

import (
"github.com/dmonay/okra/common"
"github.com/gin-gonic/gin"
"gopkg.in/mgo.v2/bson"
)
Expand All @@ -11,13 +12,7 @@ func (dw *DoWorkResource) UpdateObjProperties(c *gin.Context) {
obj := c.Params.ByName("objective")
id := bson.ObjectIdHex(treeId)

type ObjPropertiesJson struct {
ObjName string `json:"objName",omitempty`
ObjBody string `json:"objbody",omitempty`
Completed interface{} `json:"completed",omitempty`
}

var reqBody ObjPropertiesJson
var reqBody common.ObjPropertiesJson
c.Bind(&reqBody)
newName := reqBody.ObjName
newBody := reqBody.ObjBody
Expand Down
7 changes: 2 additions & 5 deletions handlers/tree_update_name.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package handlers

import (
"github.com/dmonay/okra/common"
"github.com/gin-gonic/gin"
"gopkg.in/mgo.v2/bson"
)
Expand All @@ -10,11 +11,7 @@ func (dw *DoWorkResource) UpdateTreeName(c *gin.Context) {
treeId := c.Params.ByName("treeid")
id := bson.ObjectIdHex(treeId)

type TreeNameJson struct {
TreeName string `json:"treename"`
}

var reqBody TreeNameJson
var reqBody common.TreeNameJson
c.Bind(&reqBody)
newName := reqBody.TreeName

Expand Down
5 changes: 0 additions & 5 deletions handlers/user_register.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,7 @@ import (

func (dw *DoWorkResource) Register(c *gin.Context) {

type User struct {
Username string
}

var user common.UserJson

c.Bind(&user)

uname := user.Username
Expand Down

0 comments on commit bec6c89

Please sign in to comment.