typeorm-transactional
typeorm-transactional copied to clipboard
[Feature Request] Implement @Transactional() decorator on class level
Description
Allow using @Transactional()
decorator with the entire class (apply to all methods). This decorator needs to have the same interface as the existing one. We also need a possibility to ignore some class methods (something like another decorator or additional option).
@Transactional({ propagation: Propagation.REQUIRES_NEW })
class PostsService {
constructor() {
// ...
}
// If we need to ignore we can use a new decorator @NonTransactional()
// or using new option @Transactional({ ignore: true }) (?) think about it
async getPostById() {
// ...
}
// If we use explicit`@Transactional() then we need to override options that were defined in class-level `@Transactional`
@Transactional({ propagation: Propagation.NESTED })
async updatePost() {
// ...
}
}
Of course, we need tests and documentation for these new features.
Hi @Aliheym, when this ready to be used ?