Delete strains
This commit is contained in:
parent
20026ebfd9
commit
dd7ebf1509
2 changed files with 11 additions and 0 deletions
|
@ -217,3 +217,13 @@ func (s StrainService) Create(e *types.Entity, genus string, claims *types.Claim
|
|||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Delete deletes a single strain
|
||||
func (s StrainService) Delete(id int64, genus string, claims *types.Claims) *types.AppError {
|
||||
q := `DELETE FROM strains WHERE id=$1;`
|
||||
// TODO: fix this
|
||||
if _, err := models.DBH.Exec(q, id); err != nil {
|
||||
return newJSONError(err, http.StatusInternalServerError)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -79,6 +79,7 @@ func Handler() http.Handler {
|
|||
r{handleCreater(strainService), "POST", "/strains"},
|
||||
r{handleGetter(strainService), "GET", "/strains/{ID:.+}"},
|
||||
r{handleUpdater(strainService), "PUT", "/strains/{ID:.+}"},
|
||||
r{handleDeleter(strainService), "DELETE", "/strains/{ID:.+}"},
|
||||
r{handleLister(characteristicService), "GET", "/characteristics"},
|
||||
r{handleCreater(characteristicService), "POST", "/characteristics"},
|
||||
r{handleGetter(characteristicService), "GET", "/characteristics/{ID:.+}"},
|
||||
|
|
Reference in a new issue