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
Support for auth() in @default attribute #958
Support for auth() in @default attribute #958
Conversation
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. |
Thank you so much @ymc9! I must say I'm learning a lot from you :) Let me reply to your comments. |
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
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.ts
in 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.withPolicy
proxy).I'd appreciate going further after a quick review to ensure I'm heading in the right direction :)