Theme can be optional: exercices can be standalone

This commit is contained in:
nemunaire 2024-03-12 10:12:40 +01:00
parent 3519f7416d
commit a0bc832910
8 changed files with 81 additions and 39 deletions

View file

@ -33,7 +33,7 @@ func exerciceHandler(c *gin.Context) {
}
if th, ok := c.Get("theme"); ok {
if exercice.IdTheme != th.(*fic.Theme).Id {
if exercice.IdTheme == nil || *exercice.IdTheme != th.(*fic.Theme).Id {
c.AbortWithStatusJSON(http.StatusNotFound, gin.H{"errmsg": "Exercice not found."})
return
}