Delete characteristic
This commit is contained in:
parent
e1b4cd80fe
commit
50bee9ab88
3 changed files with 12 additions and 1 deletions
|
@ -194,3 +194,13 @@ func (c CharacteristicService) Create(e *types.Entity, genus string, claims *typ
|
|||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Delete deletes a single characteristic
|
||||
func (c CharacteristicService) Delete(id int64, genus string, claims *types.Claims) *types.AppError {
|
||||
q := `DELETE FROM characteristics WHERE id=$1;`
|
||||
// TODO: fix this
|
||||
if _, err := models.DBH.Exec(q, id); err != nil {
|
||||
return newJSONError(err, http.StatusInternalServerError)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -82,6 +82,7 @@ func Handler() http.Handler {
|
|||
r{handleCreater(characteristicService), "POST", "/characteristics"},
|
||||
r{handleGetter(characteristicService), "GET", "/characteristics/{ID:.+}"},
|
||||
r{handleUpdater(characteristicService), "PUT", "/characteristics/{ID:.+}"},
|
||||
r{handleDeleter(characteristicService), "DELETE", "/characteristics/{ID:.+}"},
|
||||
r{handleLister(measurementService), "GET", "/measurements"},
|
||||
r{handleCreater(measurementService), "POST", "/measurements"},
|
||||
r{handleGetter(measurementService), "GET", "/measurements/{ID:.+}"},
|
||||
|
|
|
@ -21,7 +21,7 @@ CREATE TABLE measurements (
|
|||
|
||||
CONSTRAINT strainscharmeasurements_pkey PRIMARY KEY (id),
|
||||
FOREIGN KEY (strain_id) REFERENCES strains(id),
|
||||
FOREIGN KEY (characteristic_id) REFERENCES characteristics(id),
|
||||
FOREIGN KEY (characteristic_id) REFERENCES characteristics(id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (text_measurement_type_id) REFERENCES text_measurement_types(id),
|
||||
FOREIGN KEY (unit_type_id) REFERENCES unit_types(id),
|
||||
FOREIGN KEY (test_method_id) REFERENCES test_methods(id),
|
||||
|
|
Reference in a new issue