parent
							
								
									7c253d7aa5
								
							
						
					
					
						commit
						b87077a1df
					
				
					 12 changed files with 79 additions and 35 deletions
				
			
		|  | @ -132,15 +132,13 @@ func (c CharacteristicService) Update(id int64, e *types.Entity, genus string, c | |||
| 	payload.Characteristic.CanEdit = helpers.CanEdit(claims, payload.Characteristic.CreatedBy) | ||||
| 
 | ||||
| 	payload.Characteristic.CharacteristicTypeID = id | ||||
| 	// TODO: fix this | ||||
| 	count, err := models.DBH.Update(payload.Characteristic.CharacteristicBase) | ||||
| 	if err != nil { | ||||
| 
 | ||||
| 	if err := models.Update(payload.Characteristic.CharacteristicBase); err != nil { | ||||
| 		if err == errors.ErrCharacteristicNotUpdated { | ||||
| 			return newJSONError(err, http.StatusBadRequest) | ||||
| 		} | ||||
| 		return newJSONError(err, http.StatusInternalServerError) | ||||
| 	} | ||||
| 	if count != 1 { | ||||
| 		// TODO: fix this | ||||
| 		return newJSONError(errors.ErrCharacteristicNotUpdated, http.StatusBadRequest) | ||||
| 	} | ||||
| 
 | ||||
| 	strains, strainOpts, err := models.StrainsFromCharacteristicID(id, genus, claims) | ||||
| 	if err != nil { | ||||
|  |  | |||
|  | @ -95,15 +95,12 @@ func (m MeasurementService) Update(id int64, e *types.Entity, genus string, clai | |||
| 		payload.Measurement.TextMeasurementTypeID.Valid = true | ||||
| 	} | ||||
| 
 | ||||
| 	// TODO: fix this | ||||
| 	count, err := models.DBH.Update(payload.Measurement.MeasurementBase) | ||||
| 	if err != nil { | ||||
| 	if err := models.Update(payload.Measurement.MeasurementBase); err != nil { | ||||
| 		if err == errors.ErrMeasurementNotUpdated { | ||||
| 			return newJSONError(err, http.StatusBadRequest) | ||||
| 		} | ||||
| 		return newJSONError(err, http.StatusInternalServerError) | ||||
| 	} | ||||
| 	if count != 1 { | ||||
| 		// TODO: fix this | ||||
| 		return newJSONError(errors.ErrStrainNotUpdated, http.StatusBadRequest) | ||||
| 	} | ||||
| 
 | ||||
| 	measurement, err := models.GetMeasurement(id, genus, claims) | ||||
| 	if err != nil { | ||||
|  |  | |||
|  | @ -93,15 +93,12 @@ func (s SpeciesService) Update(id int64, e *types.Entity, genus string, claims * | |||
| 	} | ||||
| 	payload.Species.SpeciesBase.GenusID = genusID | ||||
| 
 | ||||
| 	// TODO: fix this | ||||
| 	count, err := models.DBH.Update(payload.Species.SpeciesBase) | ||||
| 	if err != nil { | ||||
| 	if err := models.Update(payload.Species.SpeciesBase); err != nil { | ||||
| 		if err == errors.ErrSpeciesNotUpdated { | ||||
| 			return newJSONError(err, http.StatusBadRequest) | ||||
| 		} | ||||
| 		return newJSONError(err, http.StatusInternalServerError) | ||||
| 	} | ||||
| 	if count != 1 { | ||||
| 		// TODO: fix this | ||||
| 		return newJSONError(errors.ErrSpeciesNotUpdated, http.StatusBadRequest) | ||||
| 	} | ||||
| 
 | ||||
| 	// Reload to send back down the wire | ||||
| 	species, err := models.GetSpecies(id, genus, claims) | ||||
|  |  | |||
|  | @ -155,15 +155,12 @@ func (s StrainService) Update(id int64, e *types.Entity, genus string, claims *t | |||
| 	payload.Strain.UpdatedBy = claims.Sub | ||||
| 	payload.Strain.ID = id | ||||
| 
 | ||||
| 	// TODO: fix this | ||||
| 	count, err := models.DBH.Update(payload.Strain.StrainBase) | ||||
| 	if err != nil { | ||||
| 	if err := models.Update(payload.Strain.StrainBase); err != nil { | ||||
| 		if err == errors.ErrStrainNotUpdated { | ||||
| 			return newJSONError(err, http.StatusBadRequest) | ||||
| 		} | ||||
| 		return newJSONError(err, http.StatusInternalServerError) | ||||
| 	} | ||||
| 	if count != 1 { | ||||
| 		// TODO: fix this | ||||
| 		return newJSONError(errors.ErrStrainNotUpdated, http.StatusBadRequest) | ||||
| 	} | ||||
| 
 | ||||
| 	strain, err := models.GetStrain(id, genus, claims) | ||||
| 	if err != nil { | ||||
|  |  | |||
							
								
								
									
										13
									
								
								api/users.go
									
										
									
									
									
								
							
							
						
						
									
										13
									
								
								api/users.go
									
										
									
									
									
								
							|  | @ -109,15 +109,14 @@ func (u UserService) Update(id int64, e *types.Entity, dummy string, claims *typ | |||
| 		return &types.AppError{Error: err, Status: helpers.StatusUnprocessableEntity} | ||||
| 	} | ||||
| 
 | ||||
| 	// TODO: fix this | ||||
| 	count, err := models.DBH.Update(user.UserBase) | ||||
| 	user.Password = "" | ||||
| 	if err != nil { | ||||
| 	if err := models.Update(user.UserBase); err != nil { | ||||
| 		if err == errors.ErrUserNotUpdated { | ||||
| 			return newJSONError(err, http.StatusBadRequest) | ||||
| 		} | ||||
| 		return newJSONError(err, http.StatusInternalServerError) | ||||
| 	} | ||||
| 	if count != 1 { | ||||
| 		return newJSONError(errors.ErrUserNotUpdated, http.StatusInternalServerError) | ||||
| 	} | ||||
| 
 | ||||
| 	user.Password = "" | ||||
| 
 | ||||
| 	return nil | ||||
| } | ||||
|  |  | |||
		Reference in a new issue
	
	 Matthew Dillon
						Matthew Dillon