Esempio n. 1
0
// Delete - Deletes action.
func (_ *Actions) Delete(query *models.StoreAction, ok *bool) (err error) {
	// Delete action to database
	err = models.DeleteActions(query.User, query.Project, query.Name)
	if err == nil {
		*ok = true
	}
	return
}
Esempio n. 2
0
// DeleteActions - Deletes action(/s) matching selector (project and user are required, name is optional).
func DeleteActions(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
	// Get request parameters
	project := ps.ByName("project")
	user := ps.ByName("user")
	name := NameParam(ps)

	// Delete all actions matching selector
	err := models.DeleteActions(user, project, name)
	if err != nil {
		http.NotFound(w, r)
		return
	}

	// Write status ok
	w.Write(success)
}