diff --git a/component/cmp_asset.go b/component/cmp_asset.go index c31a8d7..e1eee99 100644 --- a/component/cmp_asset.go +++ b/component/cmp_asset.go @@ -6,7 +6,7 @@ import ( ) type Asset struct { - ID string `json:"-"` + ID string `json:"id"` Hash string `json:"hash,omAssetpty"` Content string `json:"content"` } diff --git a/component/cmp_category.go b/component/cmp_category.go index 05485ac..fff88ce 100644 --- a/component/cmp_category.go +++ b/component/cmp_category.go @@ -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:"-"` @@ -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, } diff --git a/component/cmp_difficulty.go b/component/cmp_difficulty.go index 86267ef..d359fde 100644 --- a/component/cmp_difficulty.go +++ b/component/cmp_difficulty.go @@ -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 @@ -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, diff --git a/component/cmp_form.go b/component/cmp_form.go index c4b020f..74dbbd3 100644 --- a/component/cmp_form.go +++ b/component/cmp_form.go @@ -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:"-"` diff --git a/component/cmp_item.go b/component/cmp_item.go index f13e477..be92d9e 100644 --- a/component/cmp_item.go +++ b/component/cmp_item.go @@ -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"` diff --git a/component/cmp_subcategory.go b/component/cmp_subcategory.go index 12ea603..387cd86 100644 --- a/component/cmp_subcategory.go +++ b/component/cmp_subcategory.go @@ -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:"-"` @@ -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, }