bugfix: 规避后台偶现失败的问题

This commit is contained in:
tim
2025-08-03 14:28:51 +08:00
parent ca9b2cb14d
commit 41f603e349
3 changed files with 21 additions and 17 deletions

View File

@@ -4,6 +4,7 @@ import com.openisle.model.Reaction;
import com.openisle.model.ReactionType;
import com.openisle.service.ReactionService;
import com.openisle.service.LevelService;
import jakarta.transaction.Transactional;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
@@ -26,6 +27,7 @@ public class ReactionController {
}
@PostMapping("/posts/{postId}/reactions")
@Transactional
public ResponseEntity<ReactionDto> reactToPost(@PathVariable Long postId,
@RequestBody ReactionRequest req,
Authentication auth) {
@@ -39,6 +41,7 @@ public class ReactionController {
}
@PostMapping("/comments/{commentId}/reactions")
@Transactional
public ResponseEntity<ReactionDto> reactToComment(@PathVariable Long commentId,
@RequestBody ReactionRequest req,
Authentication auth) {