Add authors in themes

This commit is contained in:
nemunaire 2016-01-23 12:21:02 +01:00
parent e628e7931c
commit 859dbc68cb
4 changed files with 24 additions and 17 deletions

View file

@ -23,7 +23,8 @@ type exportedExercice struct {
}
type exportedTheme struct {
Name string `json:"name"`
Name string `json:"name"`
Authors string `json:"authors"`
Exercices map[string]exportedExercice `json:"exercices"`
}
@ -46,6 +47,7 @@ func exportThemes() (interface{}, error) {
}
ret[fmt.Sprintf("%d", theme.Id)] = exportedTheme{
theme.Name,
theme.Authors,
exos,
}
}
@ -108,7 +110,8 @@ func listTheme(args []string, body []byte) (interface{}, error) {
}
type uploadedTheme struct {
Name string
Name string
Authors string
}
func creationTheme(args []string, body []byte) (interface{}, error) {
@ -129,7 +132,7 @@ func creationTheme(args []string, body []byte) (interface{}, error) {
return nil, errors.New("Theme's name not filled")
}
return fic.CreateTheme(ut.Name)
return fic.CreateTheme(ut.Name, ut.Authors)
} else {
return nil, nil
}