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

[CZID-8379] Mutations for creating entities #32

Merged
merged 10 commits into from
Aug 18, 2023

Conversation

robertaboukhalil
Copy link
Contributor

@robertaboukhalil robertaboukhalil commented Aug 17, 2023

Add GQL mutation for creating samples

entities/Makefile Show resolved Hide resolved
entities/api/core/gql_loaders.py Show resolved Hide resolved
entities/api/core/gql_loaders.py Show resolved Hide resolved
entities/tests/test_examples_gql.py Show resolved Hide resolved
entities/api/main.py Show resolved Hide resolved
@robertaboukhalil robertaboukhalil marked this pull request as ready for review August 17, 2023 23:21
@robertaboukhalil
Copy link
Contributor Author

Oups, just realized I forgot to define and use Cerbos policies for this

session.add(new_entity)
await session.commit()

# Return GQL object to client (FIXME: is there a better way to convert `new_entity` to `gql_type`?)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohhh, interesting - I think we're relying on strawberry_sqlalchemy_mapper to do this for us in the queries. I wonder if we can leverage the types it's already generated to do this automatically 🤔

Copy link
Collaborator

@jgadling jgadling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

w00!

@robertaboukhalil robertaboukhalil merged commit 119f536 into main Aug 18, 2023
2 checks passed
@robertaboukhalil robertaboukhalil deleted the raboukhalil/CZID-8379-creation-mutations branch August 18, 2023 19:49
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

Successfully merging this pull request may close these issues.

2 participants