Is there a way to createQuery?
See original GitHub issueFeathers-sequelize accepts the context.params.query and then in the background builds a sequelize query which gets executed.
I want to use the feathers params still but also add my own feathers where logic.
Context.params.query
{ email: test@example.com, $limit: 1 }
Looking at the following query:
context.params.sequelize = {
raw: false,
include: [{
model: organisations,
where: organisationId ? { id: organisationId } : undefined,
include: [{
model: roles,
where: roleId ? { id: roleId } : undefined,
}],
}],
where: single ? (
sequelize.and(
sequelize.where(
sequelize.col('"organisations->organisation_users"."roleId"'),
sequelize.col('"organisations->roles"."id"'),
),
sequelize.where(
sequelize.col('"organisations->organisation_users"."userId"'),
sequelize.col("users.id")
)
)
) : undefined,
}
Since I have defined my own where statement, it is overriding the one that feathers will make. I want to be able to merge them so my query and the feathers, limits, filters etc… continue to work as expected.
If someone has an alternative solution I am open. If there is a way to move my current sequelize where statements etc…
Thank you & Regards, Emir
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Creating Queries Using the Java Persistence Query Language
The createQuery method is used to create dynamic queries, which are queries ... createQuery( "SELECT c FROM Customer c WHERE c.name LIKE :custName")...
Read more >Chapter 14. Creating and executing queries
You create queries with the EntityManager#createQuery() method and its variants. You can write the query in the Java Persistence Query Language (JPQL), ...
Read more >Create a query, form, or report in Access - Microsoft Support
Create a query to focus on specific data. Select Create > Query Wizard . Select Simple Query, and then OK. Select the table...
Read more >When use createQuery() and find() methods of EntityManager?
In a nutshell, createQuery allows you to retrieve entities in a more dynamic fashion, while find limits you to searching for an entity...
Read more >JPA Criteria Queries - Baeldung
Learn how to use the @Query annotation in Spring Data JPA to define ... of CriteriaQuery by calling the CriteriaBuilder createQuery() method ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry I’m just seeing this (I get too many github notifications… some fall through the cracks). Anyhow, inside a before hook, you should be able do something like this:
That should get you close. Hope that helps.
You can achieve what you want by updating the
context.params.query
. You do not want to pass a top-level “where” property incontext.params.sequelize
. Here is what the full code would look like: