Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@

@Service
@RequiredArgsConstructor
@Transactional(readOnly = true)
public class MatchParticipantService {

private final MatchParticipantRepository matchParticipantRepository;

@Transactional(readOnly = true)
public MyMatchesResponse getMyParticipant(String cognitoSub) {

List<MyMatchesResponse.MatchInfo> matches =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.stream.Collectors;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.nextcloudlab.kickytime.match.dto.MatchCreateRequestDto;
import com.nextcloudlab.kickytime.match.dto.MatchResponseDto;
Expand All @@ -18,10 +19,7 @@
import com.nextcloudlab.kickytime.user.entity.User;
import com.nextcloudlab.kickytime.user.repository.UserRepository;

import jakarta.transaction.Transactional;

@Service
@Transactional
public class MatchService {

private final MatchRepository matchRepository;
Expand All @@ -38,14 +36,15 @@ public MatchService(
}

// 전체 경기 목록 조회
@Transactional()
@Transactional(readOnly = true)
public List<MatchResponseDto> getAllMatches() {
List<Match> matches = matchRepository.findAllByOrderByMatchDateTimeDesc();

return matches.stream().map(MatchResponseDto::new).collect(Collectors.toList());
}

// 경기 개설
@Transactional
public void createMatch(MatchCreateRequestDto requestDto) {
User user =
userRepository
Expand All @@ -67,6 +66,7 @@ public void createMatch(MatchCreateRequestDto requestDto) {
}

// 경기 참여 신청
@Transactional
public void joinMatch(Long matchId, String cognitoSub) {
Match match =
matchRepository
Expand Down Expand Up @@ -105,6 +105,7 @@ public void joinMatch(Long matchId, String cognitoSub) {
}

// 경기 참여 취소(일반회원)
@Transactional
public void leaveMatch(Long matchId, String cognitoSub) {
Match match =
matchRepository
Expand All @@ -125,6 +126,7 @@ public void leaveMatch(Long matchId, String cognitoSub) {
}

// 매치 삭제 기능
@Transactional
public void deleteMatchById(Long matchId) {
if (!matchRepository.existsById(matchId)) {
throw new IllegalArgumentException("해당 매치를 찾을 수 없습니다.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.nextcloudlab.kickytime.user.entity.User;
import com.nextcloudlab.kickytime.user.repository.UserRepository;

import jakarta.transaction.Transactional;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import software.amazon.awssdk.services.cognitoidentityprovider.CognitoIdentityProviderClient;
Expand All @@ -24,10 +24,12 @@ public class CognitoBackfillService {
@Value("${app.cognito.user-pool-id}")
private String userPoolId;

@Transactional(readOnly = true)
public BackfillReport backfillAllUsers() {
return backfillReport();
}

@Transactional
public BackfillReport backfillReport() {
int processed = 0, created = 0, updated = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.server.ResponseStatusException;

import com.nextcloudlab.kickytime.user.dto.UserDto;
import com.nextcloudlab.kickytime.user.entity.User;
import com.nextcloudlab.kickytime.user.repository.UserRepository;

import jakarta.transaction.Transactional;
import lombok.RequiredArgsConstructor;

@Service
Expand Down Expand Up @@ -45,7 +45,7 @@ public User findOrCreateUser(
});
}

@Transactional
@Transactional(readOnly = true)
public UserDto getByCognitoSub(String cognitoSub) {
User me =
userRepository
Expand Down
Loading