From 993b83f8e7122313602ae8e713e9d0d724e7023e Mon Sep 17 00:00:00 2001 From: nemunaire Date: Sat, 9 Dec 2017 02:58:39 +0100 Subject: [PATCH] admin: can sync exercices --- admin/api/exercice.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/admin/api/exercice.go b/admin/api/exercice.go index dd1ac5ba..69324d71 100644 --- a/admin/api/exercice.go +++ b/admin/api/exercice.go @@ -35,6 +35,15 @@ func init() { router.GET("/api/exercices/:eid/keys/:kid", apiHandler(keyHandler(showExerciceKey))) router.PUT("/api/exercices/:eid/keys/:kid", apiHandler(keyHandler(updateExerciceKey))) router.DELETE("/api/exercices/:eid/keys/:kid", apiHandler(keyHandler(deleteExerciceKey))) + + + // Synchronize + router.GET("/api/sync/exercices/:eid/files", apiHandler(exerciceHandler( + func(exercice fic.Exercice, _ []byte) (interface{}, error) { return sync.SyncExerciceFiles(sync.GlobalImporter, exercice), nil }))) + router.GET("/api/sync/exercices/:eid/hints", apiHandler(exerciceHandler( + func(exercice fic.Exercice, _ []byte) (interface{}, error) { return sync.SyncExerciceHints(sync.GlobalImporter, exercice), nil }))) + router.GET("/api/sync/exercices/:eid/keys", apiHandler(exerciceHandler( + func(exercice fic.Exercice, _ []byte) (interface{}, error) { return sync.SyncExerciceKeys(sync.GlobalImporter, exercice), nil }))) } func listExercices(_ httprouter.Params, body []byte) (interface{}, error) {