added explicit errors when trying to truncate view collections or deleting view records

This commit is contained in:
Gani Georgiev
2024-10-09 11:51:03 +03:00
parent 2c2246ecb9
commit c09cd8364a
7 changed files with 61 additions and 4 deletions

View File

@@ -378,7 +378,13 @@ func (app *BaseApp) registerRecordHooks() {
e.Context,
e.App,
InterceptorActionDelete,
e.Next,
func() error {
if e.Record.Collection().IsView() {
return errors.New("view records cannot be deleted")
}
return e.Next()
},
)
},
Priority: -99,