diff --git a/src/main/java/com/back/catchmate/domain/board/converter/BoardConverter.java b/src/main/java/com/back/catchmate/domain/board/converter/BoardConverter.java index 754c888..b0a9cf3 100644 --- a/src/main/java/com/back/catchmate/domain/board/converter/BoardConverter.java +++ b/src/main/java/com/back/catchmate/domain/board/converter/BoardConverter.java @@ -9,11 +9,9 @@ import com.back.catchmate.domain.game.dto.GameResponse.GameInfo; import com.back.catchmate.domain.game.entity.Game; import com.back.catchmate.domain.user.converter.UserConverter; -import com.back.catchmate.domain.user.dto.UserResponse; import com.back.catchmate.domain.user.dto.UserResponse.UserInfo; import com.back.catchmate.domain.user.entity.User; import lombok.RequiredArgsConstructor; -import org.springframework.cglib.core.Local; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageImpl; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/back/catchmate/domain/board/dto/BoardResponse.java b/src/main/java/com/back/catchmate/domain/board/dto/BoardResponse.java index 9167455..8c05de0 100644 --- a/src/main/java/com/back/catchmate/domain/board/dto/BoardResponse.java +++ b/src/main/java/com/back/catchmate/domain/board/dto/BoardResponse.java @@ -1,7 +1,6 @@ package com.back.catchmate.domain.board.dto; import com.back.catchmate.domain.game.dto.GameResponse.GameInfo; -import com.back.catchmate.domain.user.dto.UserResponse; import com.back.catchmate.domain.user.dto.UserResponse.UserInfo; import lombok.AllArgsConstructor; import lombok.Builder; diff --git a/src/main/java/com/back/catchmate/domain/board/service/BoardService.java b/src/main/java/com/back/catchmate/domain/board/service/BoardService.java index 48810ea..86b2b07 100644 --- a/src/main/java/com/back/catchmate/domain/board/service/BoardService.java +++ b/src/main/java/com/back/catchmate/domain/board/service/BoardService.java @@ -1,11 +1,9 @@ package com.back.catchmate.domain.board.service; -import com.back.catchmate.domain.board.dto.BoardRequest; import com.back.catchmate.domain.board.dto.BoardResponse.BoardDeleteInfo; import com.back.catchmate.domain.board.dto.BoardResponse.BoardInfo; import com.back.catchmate.domain.board.dto.BoardResponse.PagedBoardInfo; import org.springframework.data.domain.Pageable; -import org.springframework.transaction.annotation.Transactional; import java.time.LocalDate; diff --git a/src/main/java/com/back/catchmate/domain/club/converter/ClubConverter.java b/src/main/java/com/back/catchmate/domain/club/converter/ClubConverter.java index 121e989..98207c6 100644 --- a/src/main/java/com/back/catchmate/domain/club/converter/ClubConverter.java +++ b/src/main/java/com/back/catchmate/domain/club/converter/ClubConverter.java @@ -1,13 +1,11 @@ package com.back.catchmate.domain.club.converter; -import com.back.catchmate.domain.club.dto.ClubResponse; import com.back.catchmate.domain.club.dto.ClubResponse.ClubInfo; import com.back.catchmate.domain.club.dto.ClubResponse.ClubInfoList; import com.back.catchmate.domain.club.entity.Club; import org.springframework.stereotype.Component; import java.util.List; -import java.util.stream.Collectors; @Component public class ClubConverter { diff --git a/src/main/java/com/back/catchmate/domain/club/service/ClubServiceImpl.java b/src/main/java/com/back/catchmate/domain/club/service/ClubServiceImpl.java index aa0b863..0555db8 100644 --- a/src/main/java/com/back/catchmate/domain/club/service/ClubServiceImpl.java +++ b/src/main/java/com/back/catchmate/domain/club/service/ClubServiceImpl.java @@ -2,6 +2,7 @@ import com.back.catchmate.domain.club.converter.ClubConverter; import com.back.catchmate.domain.club.dto.ClubResponse; +import com.back.catchmate.domain.club.dto.ClubResponse.ClubInfoList; import com.back.catchmate.domain.club.entity.Club; import com.back.catchmate.domain.club.repository.ClubRepository; import lombok.RequiredArgsConstructor; @@ -18,7 +19,7 @@ public class ClubServiceImpl implements ClubService { @Override @Transactional(readOnly = true) - public ClubResponse.ClubInfoList getClubInfoList() { + public ClubInfoList getClubInfoList() { List clubList = clubRepository.findAll(); return clubConverter.toClubInfoList(clubList); } diff --git a/src/main/java/com/back/catchmate/domain/game/entity/Game.java b/src/main/java/com/back/catchmate/domain/game/entity/Game.java index a59b818..4edb2ef 100644 --- a/src/main/java/com/back/catchmate/domain/game/entity/Game.java +++ b/src/main/java/com/back/catchmate/domain/game/entity/Game.java @@ -3,8 +3,22 @@ import com.back.catchmate.domain.board.entity.Board; import com.back.catchmate.domain.club.entity.Club; import com.back.catchmate.global.entity.BaseTimeEntity; -import jakarta.persistence.*; -import lombok.*; +import jakarta.persistence.Column; +import jakarta.persistence.Id; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.OneToMany; +import jakarta.persistence.Table; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; import java.time.LocalDateTime; import java.util.ArrayList; diff --git a/src/main/java/com/back/catchmate/domain/game/repository/GameRepository.java b/src/main/java/com/back/catchmate/domain/game/repository/GameRepository.java index 8f352ea..ad5dc74 100644 --- a/src/main/java/com/back/catchmate/domain/game/repository/GameRepository.java +++ b/src/main/java/com/back/catchmate/domain/game/repository/GameRepository.java @@ -1,6 +1,5 @@ package com.back.catchmate.domain.game.repository; -import com.back.catchmate.domain.board.entity.Board; import com.back.catchmate.domain.club.entity.Club; import com.back.catchmate.domain.game.entity.Game; import org.springframework.data.jpa.repository.JpaRepository; @@ -9,5 +8,4 @@ public interface GameRepository extends JpaRepository { Game findByHomeClubAndAwayClubAndGameStartDate(Club homeClub, Club awayClub, LocalDateTime gameStartDate); - } diff --git a/src/main/java/com/back/catchmate/domain/notification/dto/NotificationResponse.java b/src/main/java/com/back/catchmate/domain/notification/dto/NotificationResponse.java index b6dc48a..2d9622c 100644 --- a/src/main/java/com/back/catchmate/domain/notification/dto/NotificationResponse.java +++ b/src/main/java/com/back/catchmate/domain/notification/dto/NotificationResponse.java @@ -24,15 +24,6 @@ public static class NotificationInfo { private boolean isRead; } - @Getter - @Builder - @NoArgsConstructor - @AllArgsConstructor - public static class CreateNotificationInfo { - private Long notificationId; - private LocalDateTime createdAt; - } - @Getter @Builder @AllArgsConstructor diff --git a/src/main/java/com/back/catchmate/domain/user/controller/UserController.java b/src/main/java/com/back/catchmate/domain/user/controller/UserController.java index 6869e9d..fe3d955 100644 --- a/src/main/java/com/back/catchmate/domain/user/controller/UserController.java +++ b/src/main/java/com/back/catchmate/domain/user/controller/UserController.java @@ -1,6 +1,9 @@ package com.back.catchmate.domain.user.controller; import com.back.catchmate.domain.user.dto.UserRequest; +import com.back.catchmate.domain.user.dto.UserResponse.LoginInfo; +import com.back.catchmate.domain.user.dto.UserResponse.UpdateAlarmInfo; +import com.back.catchmate.domain.user.dto.UserResponse.UserInfo; import com.back.catchmate.domain.user.entity.AlarmType; import com.back.catchmate.domain.user.service.UserService; import com.back.catchmate.global.dto.StateResponse; @@ -22,8 +25,6 @@ import java.io.IOException; -import static com.back.catchmate.domain.user.dto.UserResponse.*; - @Tag(name = "사용자 관련 API") @RestController @RequestMapping("/user") @@ -61,8 +62,8 @@ public StateResponse updateProfile(@RequestPart("request") @Valid UserRequest.Us @Operation(summary = "알림 설정", description = "유저의 알람 수신 여부를 변경하는 API 입니다.") @PatchMapping("/alarm") public UpdateAlarmInfo updateAlarm(@JwtValidation Long userId, - @RequestParam("alarmType") AlarmType alarmType, - @RequestParam("isEnabled") char isEnabled) { + @RequestParam("alarmType") AlarmType alarmType, + @RequestParam("isEnabled") char isEnabled) { return userService.updateAlarm(userId, alarmType, isEnabled); } } diff --git a/src/main/java/com/back/catchmate/domain/user/service/UserServiceImpl.java b/src/main/java/com/back/catchmate/domain/user/service/UserServiceImpl.java index 21c41ac..e7c9d2a 100644 --- a/src/main/java/com/back/catchmate/domain/user/service/UserServiceImpl.java +++ b/src/main/java/com/back/catchmate/domain/user/service/UserServiceImpl.java @@ -25,7 +25,6 @@ import org.springframework.web.multipart.MultipartFile; import java.io.IOException; -import java.util.UUID; import static com.back.catchmate.global.auth.service.AuthServiceImpl.PROVIDER_ID_SEPARATOR; diff --git a/src/main/java/com/back/catchmate/global/auth/controller/AuthController.java b/src/main/java/com/back/catchmate/global/auth/controller/AuthController.java index 57ff3bf..8c172cf 100644 --- a/src/main/java/com/back/catchmate/global/auth/controller/AuthController.java +++ b/src/main/java/com/back/catchmate/global/auth/controller/AuthController.java @@ -1,9 +1,9 @@ package com.back.catchmate.global.auth.controller; -import com.back.catchmate.global.auth.dto.request.AuthRequest; -import com.back.catchmate.global.auth.dto.response.AuthResponse.LoginInfo; -import com.back.catchmate.global.auth.dto.response.AuthResponse.NicknameCheckInfo; -import com.back.catchmate.global.auth.dto.response.AuthResponse.ReissueInfo; +import com.back.catchmate.global.auth.dto.AuthRequest.LoginRequest; +import com.back.catchmate.global.auth.dto.AuthResponse.AuthInfo; +import com.back.catchmate.global.auth.dto.AuthResponse.NicknameCheckInfo; +import com.back.catchmate.global.auth.dto.AuthResponse.ReissueInfo; import com.back.catchmate.global.auth.service.AuthServiceImpl; import com.back.catchmate.global.dto.StateResponse; import io.swagger.v3.oas.annotations.Operation; @@ -28,7 +28,7 @@ public class AuthController { @PostMapping("/login") @Operation(summary = "로그인 & 회원가입 API", description = "회원가입/로그인을 통해 토큰을 발급하는 API 입니다.") - public LoginInfo login(@Valid @RequestBody AuthRequest.LoginRequest loginRequest) { + public AuthInfo login(@Valid @RequestBody LoginRequest loginRequest) { return authService.login(loginRequest); } diff --git a/src/main/java/com/back/catchmate/global/auth/converter/AuthConverter.java b/src/main/java/com/back/catchmate/global/auth/converter/AuthConverter.java index 5093ac7..73ac5c2 100644 --- a/src/main/java/com/back/catchmate/global/auth/converter/AuthConverter.java +++ b/src/main/java/com/back/catchmate/global/auth/converter/AuthConverter.java @@ -1,13 +1,13 @@ package com.back.catchmate.global.auth.converter; -import com.back.catchmate.global.auth.dto.response.AuthResponse.LoginInfo; +import com.back.catchmate.global.auth.dto.AuthResponse.AuthInfo; import org.springframework.stereotype.Component; @Component public class AuthConverter { - public LoginInfo toLoginInfo(String accessToken, String refreshToken, Boolean isFirstLogin) { - return LoginInfo.builder() + public AuthInfo toLoginInfo(String accessToken, String refreshToken, Boolean isFirstLogin) { + return AuthInfo.builder() .accessToken(accessToken) .refreshToken(refreshToken) .isFirstLogin(isFirstLogin) diff --git a/src/main/java/com/back/catchmate/global/auth/dto/request/AuthRequest.java b/src/main/java/com/back/catchmate/global/auth/dto/AuthRequest.java similarity index 94% rename from src/main/java/com/back/catchmate/global/auth/dto/request/AuthRequest.java rename to src/main/java/com/back/catchmate/global/auth/dto/AuthRequest.java index decb99b..85e7615 100644 --- a/src/main/java/com/back/catchmate/global/auth/dto/request/AuthRequest.java +++ b/src/main/java/com/back/catchmate/global/auth/dto/AuthRequest.java @@ -1,4 +1,4 @@ -package com.back.catchmate.global.auth.dto.request; +package com.back.catchmate.global.auth.dto; import jakarta.validation.constraints.Email; import jakarta.validation.constraints.NotNull; diff --git a/src/main/java/com/back/catchmate/global/auth/dto/response/AuthResponse.java b/src/main/java/com/back/catchmate/global/auth/dto/AuthResponse.java similarity index 87% rename from src/main/java/com/back/catchmate/global/auth/dto/response/AuthResponse.java rename to src/main/java/com/back/catchmate/global/auth/dto/AuthResponse.java index 5dd83b7..ccbffc1 100644 --- a/src/main/java/com/back/catchmate/global/auth/dto/response/AuthResponse.java +++ b/src/main/java/com/back/catchmate/global/auth/dto/AuthResponse.java @@ -1,4 +1,4 @@ -package com.back.catchmate.global.auth.dto.response; +package com.back.catchmate.global.auth.dto; import lombok.AllArgsConstructor; import lombok.Builder; @@ -10,7 +10,7 @@ public abstract class AuthResponse { @Builder @NoArgsConstructor @AllArgsConstructor - public static class LoginInfo { + public static class AuthInfo { private String accessToken; private String refreshToken; private Boolean isFirstLogin; diff --git a/src/main/java/com/back/catchmate/global/auth/service/AuthService.java b/src/main/java/com/back/catchmate/global/auth/service/AuthService.java index c0f15e7..ec3efab 100644 --- a/src/main/java/com/back/catchmate/global/auth/service/AuthService.java +++ b/src/main/java/com/back/catchmate/global/auth/service/AuthService.java @@ -1,13 +1,13 @@ package com.back.catchmate.global.auth.service; -import com.back.catchmate.global.auth.dto.request.AuthRequest; -import com.back.catchmate.global.auth.dto.response.AuthResponse.LoginInfo; -import com.back.catchmate.global.auth.dto.response.AuthResponse.NicknameCheckInfo; -import com.back.catchmate.global.auth.dto.response.AuthResponse.ReissueInfo; +import com.back.catchmate.global.auth.dto.AuthRequest; +import com.back.catchmate.global.auth.dto.AuthResponse.AuthInfo; +import com.back.catchmate.global.auth.dto.AuthResponse.NicknameCheckInfo; +import com.back.catchmate.global.auth.dto.AuthResponse.ReissueInfo; import com.back.catchmate.global.dto.StateResponse; public interface AuthService { - LoginInfo login(AuthRequest.LoginRequest loginRequest); + AuthInfo login(AuthRequest.LoginRequest loginRequest); NicknameCheckInfo checkNickname(String nickName); diff --git a/src/main/java/com/back/catchmate/global/auth/service/AuthServiceImpl.java b/src/main/java/com/back/catchmate/global/auth/service/AuthServiceImpl.java index 84acf89..ca17fdb 100644 --- a/src/main/java/com/back/catchmate/global/auth/service/AuthServiceImpl.java +++ b/src/main/java/com/back/catchmate/global/auth/service/AuthServiceImpl.java @@ -3,10 +3,10 @@ import com.back.catchmate.domain.user.entity.User; import com.back.catchmate.domain.user.repository.UserRepository; import com.back.catchmate.global.auth.converter.AuthConverter; -import com.back.catchmate.global.auth.dto.request.AuthRequest; -import com.back.catchmate.global.auth.dto.response.AuthResponse.LoginInfo; -import com.back.catchmate.global.auth.dto.response.AuthResponse.NicknameCheckInfo; -import com.back.catchmate.global.auth.dto.response.AuthResponse.ReissueInfo; +import com.back.catchmate.global.auth.dto.AuthRequest; +import com.back.catchmate.global.auth.dto.AuthResponse.AuthInfo; +import com.back.catchmate.global.auth.dto.AuthResponse.NicknameCheckInfo; +import com.back.catchmate.global.auth.dto.AuthResponse.ReissueInfo; import com.back.catchmate.global.auth.entity.RefreshToken; import com.back.catchmate.global.auth.repository.RefreshTokenRepository; import com.back.catchmate.global.dto.StateResponse; @@ -21,7 +21,6 @@ @Service @RequiredArgsConstructor -@Transactional(readOnly = true) public class AuthServiceImpl implements AuthService { private final JwtService jwtService; private final UserRepository userRepository; @@ -34,19 +33,19 @@ public class AuthServiceImpl implements AuthService { // 로그인 메서드 @Override @Transactional - public LoginInfo login(AuthRequest.LoginRequest loginRequest) { + public AuthInfo login(AuthRequest.LoginRequest loginRequest) { // Provider ID와 Provider를 결합한 문자열 생성 String providerIdWithProvider = loginRequest.getProviderId() + PROVIDER_ID_SEPARATOR + loginRequest.getProvider(); // 결합한 문자열로 사용자 조회 Optional findUserOptional = userRepository.findByProviderId(providerIdWithProvider); boolean isFirstLogin = false; - LoginInfo loginInfo; + AuthInfo authInfo; if (findUserOptional.isEmpty()) { // 사용자가 없으면 최초 회원가입 여부를 true 반환 isFirstLogin = true; - loginInfo = authConverter.toLoginInfo(null, null, isFirstLogin); + authInfo = authConverter.toLoginInfo(null, null, isFirstLogin); } else { // 회원가입된 사용자가 있으면 AccessToken과 RefreshToken 반환 User user = findUserOptional.get(); @@ -61,10 +60,10 @@ public LoginInfo login(AuthRequest.LoginRequest loginRequest) { // RefreshToken을 Redis에 저장 refreshTokenRepository.save(RefreshToken.of(refreshToken, userId)); - loginInfo = authConverter.toLoginInfo(accessToken, refreshToken, isFirstLogin); + authInfo = authConverter.toLoginInfo(accessToken, refreshToken, isFirstLogin); } - return loginInfo; + return authInfo; } private void checkFcmToken(AuthRequest.LoginRequest loginRequest, User user) { @@ -74,6 +73,7 @@ private void checkFcmToken(AuthRequest.LoginRequest loginRequest, User user) { } // 닉네임 중복여부를 확인하는 메서드 + @Override @Transactional(readOnly = true) public NicknameCheckInfo checkNickname(String nickName) { boolean isAvailable = !userRepository.existsByNickName(nickName); @@ -81,6 +81,7 @@ public NicknameCheckInfo checkNickname(String nickName) { } // 토큰 재발급 메서드 + @Override @Transactional public ReissueInfo reissue(String refreshToken) { // RefreshToken을 파싱하여 사용자 ID를 가져옴 @@ -95,6 +96,7 @@ public ReissueInfo reissue(String refreshToken) { } // 로그아웃 메서드 + @Override @Transactional public StateResponse logout(String refreshToken) { // RefreshToken을 파싱하여 사용자 ID를 가져옴