Skip to content

Commit

Permalink
Adding IDs to tree
Browse files Browse the repository at this point in the history
  • Loading branch information
klaidliadon committed Dec 14, 2017
1 parent 7759e2c commit 5b88da1
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion component/cmp_asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

type Asset struct {
ID string `json:"-"`
ID string `json:"id"`
Hash string `json:"hash,omAssetpty"`
Content string `json:"content"`
}
Expand Down
3 changes: 2 additions & 1 deletion component/cmp_category.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
)

type Category struct {
ID string `json:"-"`
ID string `json:"id"`
Name string `json:"name"`
Hash string `json:"hash"`
Locale string `json:"-"`
Expand Down Expand Up @@ -38,6 +38,7 @@ func (c *Category) Tree(html bool) interface{} {
subs = append(subs, c.subcategories[i].Tree(html))
}
return map[string]interface{}{
"id": c.ID,
"name": c.Name,
"subcategories": subs,
}
Expand Down
3 changes: 2 additions & 1 deletion component/cmp_difficulty.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

type Difficulty struct {
parent *Subcategory
ID string `json:"-"`
ID string `json:"id"`
Name string `json:"name"`
Hash string `json:"hash"`
items []*Item
Expand Down Expand Up @@ -37,6 +37,7 @@ func (d *Difficulty) Tree(html bool) interface{} {
}
}
return map[string]interface{}{
"id": d.ID,
"name": d.Name,
"items": items,
"checks": d.checklist.Checks,
Expand Down
2 changes: 1 addition & 1 deletion component/cmp_form.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

type Form struct {
ID string `json:"-"`
ID string `json:"id"`
Name string `json:"name"`
Hash string `json:"hash"`
Locale string `json:"-"`
Expand Down
2 changes: 1 addition & 1 deletion component/cmp_item.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const paragraphSep = "\n\n"

type Item struct {
parent *Difficulty
ID string `json:"-"`
ID string `json:"id"`
Hash string `json:"hash,omitempty"`
Title string `json:"title"`
Body string `json:"body"`
Expand Down
3 changes: 2 additions & 1 deletion component/cmp_subcategory.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

type Subcategory struct {
parent *Category
ID string `json:"-"`
ID string `json:"id"`
Name string `json:"name"`
Hash string `json:"hash"`
Order float64 `json:"-"`
Expand All @@ -34,6 +34,7 @@ func (s *Subcategory) Tree(html bool) interface{} {
difficulties[i] = v.Tree(html)
}
return map[string]interface{}{
"id": s.ID,
"name": s.Name,
"difficulties": difficulties,
}
Expand Down

0 comments on commit 5b88da1

Please sign in to comment.