admin: Implement theme synchronization

This commit is contained in:
nemunaire 2017-12-08 21:01:42 +01:00
parent 38606f28c7
commit 4d1dde4528
2 changed files with 84 additions and 0 deletions

View file

@ -6,6 +6,7 @@ import (
"fmt"
"strconv"
"srs.epita.fr/fic-server/admin/sync"
"srs.epita.fr/fic-server/libfic"
"github.com/julienschmidt/httprouter"
@ -37,6 +38,14 @@ func init() {
router.GET("/api/themes/:thid/exercices/:eid/keys", apiHandler(exerciceHandler(listExerciceKeys)))
router.POST("/api/themes/:thid/exercices/:eid/keys", apiHandler(exerciceHandler(createExerciceKey)))
// Remote
router.GET("/api/remote/themes", apiHandler(sync.ApiListRemoteThemes))
router.GET("/api/remote/themes/:thname", apiHandler(sync.ApiGetRemoteTheme))
// Synchronize
router.GET("/api/sync/themes", apiHandler(
func(_ httprouter.Params, _ []byte) (interface{}, error) { return sync.SyncThemes(sync.GlobalImporter), nil }))
}
func bindingFiles(_ httprouter.Params, body []byte) (interface{}, error) {