fix(training): check if training exists before delete
This commit is contained in:
parent
2f6c24652e
commit
2003b31f14
1 changed files with 5 additions and 0 deletions
|
|
@ -74,6 +74,11 @@ func (r *InMemoryTrainingRepository) Update(training *Training) error {
|
|||
}
|
||||
|
||||
func (r *InMemoryTrainingRepository) Delete(id TrainingID) error {
|
||||
_, ok := r.trainings[id]
|
||||
if !ok {
|
||||
return ErrTrainingNotFound
|
||||
}
|
||||
|
||||
delete(r.trainings, id)
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue