admin: synchronization of exercices, files, hints and keys

This commit is contained in:
nemunaire 2017-12-09 01:21:58 +01:00
parent a033f81f5f
commit 762d3a5222
5 changed files with 227 additions and 1 deletions

View file

@ -41,11 +41,20 @@ func init() {
// Remote
router.GET("/api/remote/themes", apiHandler(sync.ApiListRemoteThemes))
router.GET("/api/remote/themes/:thname", apiHandler(sync.ApiGetRemoteTheme))
router.GET("/api/remote/themes/:thid", apiHandler(sync.ApiGetRemoteTheme))
router.GET("/api/remote/themes/:thid/exercices", apiHandler(themeHandler(sync.ApiListRemoteExercices)))
// Synchronize
router.GET("/api/sync/themes", apiHandler(
func(_ httprouter.Params, _ []byte) (interface{}, error) { return sync.SyncThemes(sync.GlobalImporter), nil }))
router.GET("/api/sync/themes/:thid/exercices", apiHandler(themeHandler(
func(theme fic.Theme, _ []byte) (interface{}, error) { return sync.SyncExercices(sync.GlobalImporter, theme), nil })))
router.GET("/api/sync/themes/:thid/exercices/:eid/files", apiHandler(exerciceHandler(
func(exercice fic.Exercice, _ []byte) (interface{}, error) { return sync.SyncExerciceFiles(sync.GlobalImporter, exercice), nil })))
router.GET("/api/sync/themes/:thid/exercices/:eid/hints", apiHandler(exerciceHandler(
func(exercice fic.Exercice, _ []byte) (interface{}, error) { return sync.SyncExerciceHints(sync.GlobalImporter, exercice), nil })))
router.GET("/api/sync/themes/:thid/exercices/:eid/keys", apiHandler(exerciceHandler(
func(exercice fic.Exercice, _ []byte) (interface{}, error) { return sync.SyncExerciceKeys(sync.GlobalImporter, exercice), nil })))
}
func bindingFiles(_ httprouter.Params, body []byte) (interface{}, error) {