Marcel Overdijk
Explore posts from serversPPrisma
•Created by Marcel Overdijk on 10/22/2024 in #help-and-questions
How to setup multiple Prisma clients in combination with `prismaSchemaFolder`
I changed the output path to
../../../node_modules/@prisma-db1/client
and then I was able to import it with import { PrismaClient as DB1PrismaClient } from '@prisma-db1/client';
4 replies
PPrisma
•Created by Marcel Overdijk on 9/12/2024 in #help-and-questions
Order by `rowid`?
Bump. Anyone an idea if this is possible?
3 replies
DTDrizzle Team
•Created by Marcel Overdijk on 9/1/2024 in #help
Using `$dynamic()` to enhance where clause
@alexblokh I experimented a bit with you suggestion to not pass the
qb
(anti pattern) .
I'm now returning the filter and sort expressions from a helper, similar as the pagination informations.
However for joins this I have a question for which I Created a separate post: https://discord.com/channels/1043890932593987624/128260105624485891022 replies
Error: don't await SelectQueryBuilder instances directly.
thx @koskimas I already was using that (hopefully temporary) when I got the error:
and then using it like:
and that works.
I must admit, it doesn't really look pretty 😉
my other alternative is to split retrieving the async request data and enhancing the query.
that way I can make it non async
9 replies
Error: don't await SelectQueryBuilder instances directly.
I found this related issue as well: https://github.com/kysely-org/kysely/issues/838
but it does not give a solution, or maybe there is none, and an
async
function can't return a query builder?9 replies
DTDrizzle Team
•Created by Marcel Overdijk on 9/1/2024 in #help
Using `$dynamic()` to enhance where clause
but of course thx for sharing this!
22 replies
DTDrizzle Team
•Created by Marcel Overdijk on 9/1/2024 in #help
Using `$dynamic()` to enhance where clause
yes, that's possible, but it would mean that I have to do that in every endpoint:
- retrieve
page
and pageSize
arguments
- retrieve and parse sort
and filter
arguement
- and apply it to the query
instead of calling just 1 method in all my endpoints.
that would mean a lot of duplicated code, which also needs to be tested.22 replies
DTDrizzle Team
•Created by Marcel Overdijk on 9/1/2024 in #help
Using `$dynamic()` to enhance where clause
The most easy solution I see is, to pass the base where to my
this.applyQueryParams(query, baseWhere)
and then merge them and set them on the query builder there.22 replies
DTDrizzle Team
•Created by Marcel Overdijk on 9/1/2024 in #help
Using `$dynamic()` to enhance where clause
@alexblokh off course I would like to remove anti-patterns from code base, so I'm very interested in your opinion.
22 replies
DTDrizzle Team
•Created by Marcel Overdijk on 9/1/2024 in #help
Using `$dynamic()` to enhance where clause
I'm using this pattern with
this.applyQueryParams(query)
in many endpoints to automatically enhance the query with pagination, sorting and filtering.
It's really nice as I don't have to take care of that anymore in each endpoint, but in 1 general place and consistent everywhere.22 replies
DTDrizzle Team
•Created by Marcel Overdijk on 9/1/2024 in #help
Using `$dynamic()` to enhance where clause
and the
applyFilter
is similar, although it's a bit more complicated 😉
22 replies
DTDrizzle Team
•Created by Marcel Overdijk on 9/1/2024 in #help
Using `$dynamic()` to enhance where clause
22 replies
DTDrizzle Team
•Created by Marcel Overdijk on 9/1/2024 in #help
Using `$dynamic()` to enhance where clause
This is the actual code:
22 replies
DTDrizzle Team
•Created by Marcel Overdijk on 9/1/2024 in #help
Using `$dynamic()` to enhance where clause
this
applyQueryParams
function has access to the HTTP query params, and based on what is provided it will apply/enhance the query with the supplied HTTP query params.22 replies
DTDrizzle Team
•Created by Marcel Overdijk on 9/1/2024 in #help
Using `$dynamic()` to enhance where clause
The other important part is the
this.applyQueryParams(query);
. This is a generic method that receives the qb: SQLiteSelect
argument.22 replies