Answer the question
In order to leave comments, you need to log in
What is the best way to organize the query structure?
Task: Get the user's balance, execute some logic and update the balance for this user (or rollback).
The structure is now like this: There is a class with custom logic and there is a class for working with database queries.
Question: Is it normal if I drag a transaction into custom logic like:
@Transaction()
public async test(userId, userRepository) {
await userRepository.findOne(userId);
... // some logic
await userRepository.update(userId, ...);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question