Skip to content

Commit 6dc5875

Browse files
authored
transactional 데코레이터로 transaction 관리하게 변경 (#134)
2 parents 0cfce3f + bbd65dc commit 6dc5875

File tree

14 files changed

+430
-793
lines changed

14 files changed

+430
-793
lines changed

package-lock.json

+77-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@
6060
"passport-jwt": "^4.0.1",
6161
"reflect-metadata": "^0.1.13",
6262
"rxjs": "^7.8.1",
63-
"typeorm": "^0.3.17"
63+
"typeorm": "^0.3.17",
64+
"typeorm-transactional": "^0.5.0"
6465
},
6566
"devDependencies": {
6667
"@faker-js/faker": "^8.3.1",

src/apis/free-post-comments/free-post-comment-history/services/free-post-comment-history.service.ts

+7-10
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,19 @@ export class FreePostCommentHistoryService {
1212
) {}
1313

1414
async create(
15-
entityManager: EntityManager,
1615
userId: number,
1716
freePostId: number,
1817
freePostCommentId: number,
1918
action: HistoryAction,
2019
createFreePostCommentHistoryDto: CreateFreePostCommentHistoryDto,
2120
) {
22-
return entityManager
23-
.withRepository(this.freePostCommentHistoryRepository)
24-
.save({
25-
userId,
26-
action,
27-
freePostId,
28-
freePostCommentId,
29-
...new CreateFreePostCommentHistoryDto(createFreePostCommentHistoryDto),
30-
});
21+
return this.freePostCommentHistoryRepository.save({
22+
userId,
23+
action,
24+
freePostId,
25+
freePostCommentId,
26+
...new CreateFreePostCommentHistoryDto(createFreePostCommentHistoryDto),
27+
});
3128
}
3229

3330
findOneOrFail(

0 commit comments

Comments
 (0)