not found del

This commit is contained in:
mr
2026-03-16 09:28:48 +01:00
parent 465b91fd6e
commit 9e5102893f

View File

@@ -70,6 +70,12 @@ func GenericStoreOne(data DBObject, a Accessor) (DBObject, int, error) {
// GenericLoadOne loads one object from the database (generic) // GenericLoadOne loads one object from the database (generic)
func GenericDeleteOne(id string, a Accessor) (DBObject, int, error) { func GenericDeleteOne(id string, a Accessor) (DBObject, int, error) {
res, code, err := a.LoadOne(id) res, code, err := a.LoadOne(id)
if err != nil {
return res, code, err
}
if res == nil {
return res, code, errors.New("not found")
}
if !res.CanDelete() { if !res.CanDelete() {
return nil, 403, errors.New("you are not allowed to delete :" + a.GetType().String()) return nil, 403, errors.New("you are not allowed to delete :" + a.GetType().String())
} }