Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Within a delete resolvers, deleting > 1 item fails in the eventhook #152

Open
rizzza opened this issue Sep 18, 2023 · 0 comments
Open

Within a delete resolvers, deleting > 1 item fails in the eventhook #152

rizzza opened this issue Sep 18, 2023 · 0 comments

Comments

@rizzza
Copy link
Contributor

rizzza commented Sep 18, 2023

Describe the bug
Say for example, we are deleting an annotationNamespace and all of it's associated annotations within one call to the ent client.

r.client.Annotation.Delete().Where(annotation.AnnotationNamespaceID(id)).Exec(ctx)

The eventhook for the annotation delete will fail because it is expecting only a singular deletion.

We receive the following error

"object doesn't have an id "

To Reproduce
Code up a delete resolver to delete all based on some predicate

Expected behavior
For the delete eventhook to be able to handle > 1 deletions of an thing at a time, rather than having to iterate and DeleteOne(id) at a time within the resolver.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

rizzza added a commit to infratographer/metadata-api that referenced this issue Sep 20, 2023
# Summary

Wire up new permissions checks for the annotation/status namespaces

- [x] Fix 🐛 ensuring we cannot set an empty `resourceProviderID` for a
status namespace
- [x] Add in events and other boilerplate for the test db setup; wire up
the ent hooks
- [x] Mock permissions in all the resolver unit tests
- [x] Add oidc auth test to verify access with and without oidc enabled
- [x] Add unit test for status namespace

[Issue](infratographer/x#152) found with event
hooks and deleting multiple things from the db in one shot. Worked
around it by deleting one record at a time.

---------

Signed-off-by: Matt Siwiec <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant