Write docs!
This commit is contained in:
parent
c460bb7bf5
commit
bcc598ebd5
37 changed files with 478 additions and 188 deletions
|
@ -29,7 +29,6 @@ func init() {
|
|||
router.PUT("/api/themes/:thid/exercices/:eid", apiHandler(exerciceHandler(updateExercice)))
|
||||
router.DELETE("/api/themes/:thid/exercices/:eid", apiHandler(exerciceHandler(deleteExercice)))
|
||||
|
||||
|
||||
router.GET("/api/themes/:thid/exercices/:eid/files", apiHandler(exerciceHandler(listExerciceFiles)))
|
||||
router.POST("/api/themes/:thid/exercices/:eid/files", apiHandler(exerciceHandler(createExerciceFile)))
|
||||
|
||||
|
@ -46,19 +45,33 @@ func init() {
|
|||
|
||||
// Synchronize
|
||||
router.POST("/api/sync/deep", apiHandler(
|
||||
func(_ httprouter.Params, _ []byte) (interface{}, error) { return sync.SyncDeep(sync.GlobalImporter), nil }))
|
||||
func(_ httprouter.Params, _ []byte) (interface{}, error) {
|
||||
return sync.SyncDeep(sync.GlobalImporter), nil
|
||||
}))
|
||||
router.POST("/api/sync/themes", apiHandler(
|
||||
func(_ httprouter.Params, _ []byte) (interface{}, error) { return sync.SyncThemes(sync.GlobalImporter), nil }))
|
||||
func(_ httprouter.Params, _ []byte) (interface{}, error) {
|
||||
return sync.SyncThemes(sync.GlobalImporter), nil
|
||||
}))
|
||||
router.POST("/api/sync/themes/:thid/exercices", apiHandler(themeHandler(
|
||||
func(theme fic.Theme, _ []byte) (interface{}, error) { return sync.SyncExercices(sync.GlobalImporter, theme), nil })))
|
||||
func(theme fic.Theme, _ []byte) (interface{}, error) {
|
||||
return sync.SyncExercices(sync.GlobalImporter, theme), nil
|
||||
})))
|
||||
router.POST("/api/sync/themes/:thid/exercices/:eid/files", apiHandler(exerciceHandler(
|
||||
func(exercice fic.Exercice, _ []byte) (interface{}, error) { return sync.SyncExerciceFiles(sync.GlobalImporter, exercice), nil })))
|
||||
func(exercice fic.Exercice, _ []byte) (interface{}, error) {
|
||||
return sync.SyncExerciceFiles(sync.GlobalImporter, exercice), nil
|
||||
})))
|
||||
router.POST("/api/sync/themes/:thid/exercices/:eid/hints", apiHandler(exerciceHandler(
|
||||
func(exercice fic.Exercice, _ []byte) (interface{}, error) { return sync.SyncExerciceHints(sync.GlobalImporter, exercice), nil })))
|
||||
func(exercice fic.Exercice, _ []byte) (interface{}, error) {
|
||||
return sync.SyncExerciceHints(sync.GlobalImporter, exercice), nil
|
||||
})))
|
||||
router.POST("/api/sync/themes/:thid/exercices/:eid/keys", apiHandler(exerciceHandler(
|
||||
func(exercice fic.Exercice, _ []byte) (interface{}, error) { return sync.SyncExerciceKeys(sync.GlobalImporter, exercice), nil })))
|
||||
func(exercice fic.Exercice, _ []byte) (interface{}, error) {
|
||||
return sync.SyncExerciceKeys(sync.GlobalImporter, exercice), nil
|
||||
})))
|
||||
router.POST("/api/sync/themes/:thid/exercices/:eid/quiz", apiHandler(exerciceHandler(
|
||||
func(exercice fic.Exercice, _ []byte) (interface{}, error) { return sync.SyncExerciceMCQ(sync.GlobalImporter, exercice), nil })))
|
||||
func(exercice fic.Exercice, _ []byte) (interface{}, error) {
|
||||
return sync.SyncExerciceMCQ(sync.GlobalImporter, exercice), nil
|
||||
})))
|
||||
|
||||
router.POST("/api/sync/themes/:thid/fixurlid", apiHandler(themeHandler(
|
||||
func(theme fic.Theme, _ []byte) (interface{}, error) {
|
||||
|
@ -96,9 +109,9 @@ func fixAllURLIds(_ httprouter.Params, _ []byte) (interface{}, error) {
|
|||
func bindingFiles(_ httprouter.Params, body []byte) (interface{}, error) {
|
||||
if files, err := fic.GetFiles(); err != nil {
|
||||
return "", err
|
||||
} else {
|
||||
ret := ""
|
||||
for _, file := range files {
|
||||
} else {
|
||||
ret := ""
|
||||
for _, file := range files {
|
||||
ret += fmt.Sprintf("%s;%s\n", file.GetOrigin(), file.Path)
|
||||
}
|
||||
return ret, nil
|
||||
|
@ -137,7 +150,6 @@ func showThemedExercice(theme fic.Theme, exercice fic.Exercice, body []byte) (in
|
|||
return exercice, nil
|
||||
}
|
||||
|
||||
|
||||
type uploadedTheme struct {
|
||||
Name string
|
||||
URLId string
|
||||
|
|
Reference in a new issue