Theme can be optional: exercices can be standalone
This commit is contained in:
parent
3519f7416d
commit
a0bc832910
8 changed files with 81 additions and 39 deletions
|
@ -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
|
||||
}
|
||||
|
|
Reference in a new issue