refac: repository updates, image attachment and deletes report the domain not-found error for an unknown id, the same for articles, users and images, and the test fakes stop returning GORM errors
This commit is contained in:
1 parent
4278d96882
commit
6a2ca07b66
14 files changed
+553
-66
No files matched your search
@@ -12,3 +12,13 @@ func mapNotFoundErr(err error, sentinel error) error {
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func deleteOrNotFound(result *gorm.DB, sentinel error) error {
|
||||
if result.Error != nil {
|
||||
return result.Error
|
||||
}
|
||||
if result.RowsAffected == 0 {
|
||||
return sentinel
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in new issue
Block a user