Support for auth() in @default attribute#958
Merged
ymc9 merged 14 commits intozenstackhq:v2from Jan 26, 2024
Merged
Conversation
Member
|
Hi @Azzerty23 , you are amazing! Thanks for working on this feature. I've been dreaming of having it for quite a while and was thinking about it yesterday 😄. It'll definitely make the code of all ZenStack users cleaner. I've skimmed through the change, and the structure looks brilliant. You must have spent quite some time to figure things out , as many pieces of code are not yet thoroughly documented. Really appreciate it! I'm not sure what happened with the test cases. Let me debug and figure out why. I'll also do a thorough review pass and attach my comments. |
ymc9
reviewed
Jan 23, 2024
Contributor
Author
|
Thank you so much @ymc9! I must say I'm learning a lot from you :) Let me reply to your comments. |
ymc9
reviewed
Jan 24, 2024
6a2531c to
3311530
Compare
- Generate a function to provide value for fields using `auth()` in `@default` so we don't need to evaluate at runtime - Correct the way of visiting nested create payload
This reverts commit 6bc36a5.
A few refactors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi, I'm trying to implement this feature: #310
It was an excellent opportunity to get hands-on experience with the codebase.
I believe I managed to get something working. But when I run the last 2 tests of
auth.test.tsin isolation, they pass. However, if I run all the tests in the file, they do not. Could you help me figure out what I missed, @ymc9, @jiashengguo, please?Also, I did not succeed in having the
@default(auth())comments in the generated Prisma schema (I simply omitted them).Here is the approach I followed:
withDefaultAuth()proxy. I did not fetch user data from the Prisma client. Is it worth a separated proxy?@default(auth())in the Prisma schema, as it is not Prisma compatible.withPolicyproxy).I'd appreciate going further after a quick review to ensure I'm heading in the right direction :)