1
0
Fork 0

fix(training): check if training exists before delete

This commit is contained in:
Vojtěch Mareš 2024-05-04 17:40:03 +02:00
parent 2f6c24652e
commit 2003b31f14
Signed by: vojtech.mares
GPG key ID: C6827B976F17240D

View file

@ -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
}