-
Notifications
You must be signed in to change notification settings - Fork 2.4k
fix: allow custom admin user collection in query presets constraints #12202
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
Conversation
Query preset is currently fixed to `user` collection. However, this will fail if one has a custom admin user collection.
It seems `relatedTo` can't be undefined in a relationship field type - hence the lint errors. I could be wrong, and the lint error is coming from somewhere else. I don't have this set up locally - updating directly on github.
@jacobsfletch I added the fallback as it seems Could you please help me check why the workflow is stuck? Thank you... 😃 |
@sam-gab the fallback should not be added just to satisfy lint. In this case we need to either update the types to reflect the sanitized fallback or assert the type directly. |
@jacobsfletch Apologies mate, maybe I'm just blur - don't quite understand what you mean. Do you mean I need to:
|
@sam-gab the args passed into the For example: {
// ...
relationTo: config.admin.user as string
} This works because the For now, we can keep the fallback as you have it, although it would technically never be used. The more permanent fix here, on the other hand, would be to properly type the args passed into this function so that neither a type assertion or a fallback is necessary. I think for now, we can merge your change as is, and just mark it with a todo. |
🚀 This is included in version v3.37.0 |
Query preset "Specific User" constraints is currently fixed to
users
collection.However, this will fail if one has a custom admin user collection.