MCPcopy Create free account
hub / github.com/Cawlumm/lyftr / DeleteProgram

Method DeleteProgram

backend/controllers/programs.go:101–117  ·  view source on GitHub ↗
(c *gin.Context)

Source from the content-addressed store, hash-verified

99 utils.BadRequest(c, "That program id isn't valid.")
100 return
101 }
102 var req models.CreateProgramRequest
103 if err := c.ShouldBindJSON(&req); err != nil {
104 utils.BadRequest(c, utils.BindMessage(err))
105 return
106 }
107 if err := validate.Struct(req); err != nil {
108 utils.ValidationError(c, err)
109 return
110 }
111 p, err := h.s.Program.Update(uid, pid, req)
112 if err == sql.ErrNoRows {
113 utils.NotFound(c, "That program no longer exists.")
114 return
115 }
116 if utils.IsForeignKeyViolation(err) {
117 utils.BadRequest(c, "One or more of those exercises no longer exist.")
118 return
119 }
120 if utils.DBError(c, err) {

Callers 1

Calls 1

DeleteMethod · 0.45

Tested by 1