diff --git a/api/admin/challenge.go b/api/admin/challenge.go index 7108198..13d2048 100644 --- a/api/admin/challenge.go +++ b/api/admin/challenge.go @@ -139,19 +139,20 @@ func EditChallenge(c *gin.Context) { c.JSON(400, gin.H{"code": 400, "msg": "Request format wrong!"}) return } - challenge := &Challenge{ - ID: cid, + attachmentString := strings.Join(request.Attachment, ",") + hintString := strings.Join(request.Hints, ",") + challenge := &CrDb{ Name: request.Name, Score: request.Score, Flag: request.Flag, Description: request.Description, - Attachment: request.Attachment, + Attachment: attachmentString, Category: request.Category, Tags: request.Tags, - Hints: request.Hints, + Hints: hintString, Visible: request.Visible, } - err := DB.Table("challenge").Where("id = ?", cid).Updates(challenge).Error + err := DB.Debug().Table("challenge").Where("id = ?", cid).Updates(challenge).Error if err != nil { c.JSON(400, gin.H{"code": 400, "msg": "Update challenge failure!"}) return