Any tips on how to write this w/o breaking DRY pri...
# orm-help
g
Any tips on how to write this w/o breaking DRY principles.
d
Hey @Gelo!! Can you elaborate more on what you are trying to accomplish?
d
I think that he is asking for a way to abstract both functions. Because (and I’m guessing here) the data being passed to
.findMany
and
.count
are similar?..
@Gelo for once you could spread the similar data from a value into that. for example:
Copy code
data = {
//stuff_from_skip_to_dateCreated_key
}
and pass ..data (using spread operator) into each
.findMany
 and 
.count
calls
l
Copy code
const where = {/* that big object */} as const
$transaction([visit.findMany({where, select}), visit.count({where})])
❤️ 1
g
@Diego Feder yes correct