Skip to content

Instantly share code, notes, and snippets.

@alphamikle
Last active February 11, 2021 18:42
Show Gist options
  • Save alphamikle/7e7db00ba05ce5609c4a50965ae0b5ad to your computer and use it in GitHub Desktop.
Save alphamikle/7e7db00ba05ce5609c4a50965ae0b5ad to your computer and use it in GitHub Desktop.
import { getConnection } from 'typeorm';
// ...
@Post('remittance-with-typeorm-transaction')
@ApiResponse({
type: RemittanceResultDto,
})
async makeRemittanceWithTypeOrmTransaction(@Body() remittanceDto: RemittanceDto) {
return await getConnection().transaction(transactionManager => {
return this.appService.makeRemittanceWithTypeOrmV1(transactionManager, remittanceDto.userIdFrom, remittanceDto.userIdTo, remittanceDto.sum, remittanceDto.withError);
});
}
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment