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

Add queryTransform hook #280

Closed
wants to merge 1 commit into from
Closed

Add queryTransform hook #280

wants to merge 1 commit into from

Conversation

brian17lai
Copy link
Contributor

No description provided.

@brian17lai brian17lai requested review from a team, joshgachnang, kjkurtz and hchamorro and removed request for a team December 1, 2023 05:12
@@ -79,6 +79,9 @@ export interface FernsRouterOptions<T> {
user?: User,
query?: Record<string, any>
) => Record<string, any> | null | Promise<Record<string, any> | null>;
/** queryTransform is a function to transform the query params before they are used to query the database. This can be
* used to run intermediate queries to generate query fields for the main query. Runs before the queryFilter. */
queryTransform?: (query: Record<string, any>) => Record<string, any>;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you write a test? And what would you do here that you wouldn't do in query filter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

mm, yes we could use the query filter that's true. the description just seemed to imply that it's only used to see if the query was allowed. I'll close this

@brian17lai brian17lai closed this Dec 2, 2023
@brian17lai brian17lai deleted the transform-query branch December 2, 2023 04:15
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