Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imporve_version_2.6 deploy #69

Merged
merged 27 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
cecaebe
setTop100Users ResponseDTO 변경
Leewonchan14 Dec 29, 2023
94f36bd
DAO 연관관계 설정
Leewonchan14 Dec 29, 2023
3ca2431
Repository 메서드 명 변경
Leewonchan14 Dec 29, 2023
58ead76
에러 해결
Leewonchan14 Dec 29, 2023
9148ad0
Merge pull request #63 from Dev-Tinos/Improve/이원찬
Leewonchan14 Dec 31, 2023
8f6db70
Service @Transaction 걸기
Leewonchan14 Dec 30, 2023
01ad08b
Long page, Long size Integer로 변경
Leewonchan14 Dec 30, 2023
78488a4
LogCatchTopChange 로직 변경
Leewonchan14 Dec 30, 2023
3da6504
게임 조회 랭킹 컨트롤러에서 게임 컨트롤러로 변경
Leewonchan14 Dec 30, 2023
16ccc2f
GameDAO createAt (생성일) 필드 추가
Leewonchan14 Dec 30, 2023
2b03d40
GameDTO -> GameCreateResultDTO로 변경
Leewonchan14 Dec 30, 2023
df8f95f
page, size 유효성 검사 어노테이션 추가
Leewonchan14 Dec 30, 2023
80c2a1c
게임 목록 조회 API 정렬 옵션 제공
Leewonchan14 Dec 31, 2023
9a702a1
게임 목록 조회 API SmallBean 으로 변경
Leewonchan14 Dec 31, 2023
525ff80
게임 목록 조회 API SmallBeanTest 코드 작성
Leewonchan14 Dec 31, 2023
b2d0672
Merge pull request #64 from Dev-Tinos/Improve/이원찬
woojin065 Dec 31, 2023
f2f8aa9
이미지 초기화 테스트 코드 구현
woojin065 Dec 31, 2023
5106666
게임 목록 조회 API Swagger 설명 수정
Leewonchan14 Jan 1, 2024
660132a
LogDAO creatAt 추가
Leewonchan14 Jan 1, 2024
1819202
본인이 했던 게임 목록 조회시 가장 최근에 했던 게임 순으로 조회
Leewonchan14 Jan 1, 2024
93db41c
GameGetListByPlayedUserSmallBeanTest 테스트 통과 하게 수정
Leewonchan14 Jan 1, 2024
1992dc6
GameGetListByPlayedUserSmallBean 최적화
Leewonchan14 Jan 1, 2024
85c8db3
학과내 조회 페이징 추가
woojin065 Jan 4, 2024
9486d9b
Merge pull request #65 from Dev-Tinos/Improve/정우진
Leewonchan14 Jan 5, 2024
2191138
UserDeleteBean 유저 생성시 기본 프로필 이미지로
Leewonchan14 Jan 5, 2024
d8446db
Merge branch 'develop' into Improve/이원찬
Leewonchan14 Jan 5, 2024
2e6343d
Merge pull request #66 from Dev-Tinos/Improve/이원찬
woojin065 Jan 5, 2024
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 @@ -19,13 +19,13 @@ public class GameGetBean {

public GameGetByGameIdResponseDTO exec(Long gameId) {

GameDAO gameDAO = gameGetSmallBean.exec(gameId);
GameDAO findGame = gameGetSmallBean.exec(gameId);

gameViewCountUpdateSmallBean.exec(gameDAO);
gameViewCountUpdateSmallBean.exec(findGame);

//Review 평균 가져오기
Double starAvg = reviewGetAvgStarByGameIdSmallBean.exec(gameDAO.getGameId());
Double starAvg = reviewGetAvgStarByGameIdSmallBean.exec(findGame);

return GameGetByGameIdResponseDTO.of(gameDAO, starAvg);
return GameGetByGameIdResponseDTO.of(findGame, starAvg);
}
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
package com.example.jsgamesbackendmain.Bean.GameBean;

import com.example.jsgamesbackendmain.Bean.SmallBean.GameBean.GameGetListByPlayedUserSmallBean;
import com.example.jsgamesbackendmain.Bean.SmallBean.UserBean.UserGetByIdSmallBean;
import com.example.jsgamesbackendmain.Model.DAO.UserDAO;
import com.example.jsgamesbackendmain.Model.DTO.Game.Response.GameListResponseDTO;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.stream.Collectors;

@Component
@RequiredArgsConstructor
public class GameGetListByPlayedUser {

private final GameGetListByPlayedUserSmallBean gameGetListByPlayedUserSmallBean;
private final UserGetByIdSmallBean userGetByIdSmallBean;

public List<GameListResponseDTO> exec(String userId, Long page, Long size) {
PageRequest request = PageRequest.of(page.intValue(), size.intValue());
public List<GameListResponseDTO> exec(String userId, Integer page, Integer size) {
PageRequest request = PageRequest.of(page, size);

return gameGetListByPlayedUserSmallBean.exec(userId, request);
UserDAO findUser = userGetByIdSmallBean.exec(userId);

return gameGetListByPlayedUserSmallBean.exec(findUser, request)
.stream().map(GameListResponseDTO::of)
.collect(Collectors.toList());
}
}
Original file line number Diff line number Diff line change
@@ -1,42 +1,47 @@
package com.example.jsgamesbackendmain.Bean.GameBean;

import com.example.jsgamesbackendmain.Bean.SmallBean.GameBean.GameListOrderByCreateAtSmallBean;
import com.example.jsgamesbackendmain.Bean.SmallBean.GameBean.GameListOrderByLogCountDescSmallBean;
import com.example.jsgamesbackendmain.Bean.SmallBean.GameBean.GameListOrderByReviewCountSmallBean;
import com.example.jsgamesbackendmain.Bean.SmallBean.GameBean.GameListOrderByViewCountSmallBean;
import com.example.jsgamesbackendmain.Model.DAO.GameDAO;
import com.example.jsgamesbackendmain.Model.DTO.Game.Response.GameListResponseDTO;
import com.example.jsgamesbackendmain.Repository.GameRepository;
import com.example.jsgamesbackendmain.Model.ENUM.GameSort;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.stream.Collectors;

@Component
@RequiredArgsConstructor
public class GameListBean {
private final GameRepository gameRepository;

public List<GameListResponseDTO> exec() {
return gameRepository.findAll()
.stream()
.map(GameListResponseDTO::of)
.collect(Collectors.toList());
}

public List<GameListResponseDTO> exec(Long page, Long size) {
PageRequest pageRequest = PageRequest.of(page.intValue(), size.intValue());

return gameRepository.findAllByOrderByViewCountDescGameIdAsc(pageRequest).toList()
.stream()
.map(GameListResponseDTO::of)
.collect(Collectors.toList());
}

public List<GameListResponseDTO> exec(Long userId, Long page, Long size) {
PageRequest pageRequest = PageRequest.of(page.intValue(), size.intValue());

return gameRepository.findAllByOrderByViewCountDescGameIdAsc(pageRequest)
.toList()
.stream()
.map(GameListResponseDTO::of)
.collect(Collectors.toList());
private final GameListOrderByViewCountSmallBean gameListOrderByViewCountSmallBean;
private final GameListOrderByLogCountDescSmallBean gameListOrderByLogCountDescSmallBean;
private final GameListOrderByCreateAtSmallBean gameListOrderByCreateAtSmallBean;
private final GameListOrderByReviewCountSmallBean gameListOrderByReviewCountSmallBean;

public List<GameListResponseDTO> exec(Integer page, Integer size, GameSort sort) {
PageRequest pageRequest = PageRequest.of(page, size);

Page<GameDAO> gamePageList = null;

switch (sort) {
case VIEW_COUNT:
gamePageList = gameListOrderByViewCountSmallBean.exec(pageRequest);
break;
case LOG_COUNT:
gamePageList = gameListOrderByLogCountDescSmallBean.exec(pageRequest);
break;
case RECENT:
gamePageList = gameListOrderByCreateAtSmallBean.exec(pageRequest);
break;
case REVIEW_COUNT:
gamePageList = gameListOrderByReviewCountSmallBean.exec(pageRequest);
break;
}

return GameListResponseDTO.listOf(gamePageList);
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package com.example.jsgamesbackendmain.Bean.GameBean;

import com.example.jsgamesbackendmain.Model.DTO.Game.GameDTO;
import com.example.jsgamesbackendmain.Bean.SmallBean.UserBean.UserGetByIdSmallBean;
import com.example.jsgamesbackendmain.Model.DAO.GameDAO;
import com.example.jsgamesbackendmain.Model.DAO.UserDAO;
import com.example.jsgamesbackendmain.Model.DTO.Game.Request.GameCreateRequestDTO;
import com.example.jsgamesbackendmain.Model.DTO.Game.Response.GameCreateResultDTO;
import com.example.jsgamesbackendmain.Repository.GameRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
Expand All @@ -10,7 +13,14 @@
@RequiredArgsConstructor
public class GamePostBean {
private final GameRepository gameRepository;
public GameDTO exec(GameCreateRequestDTO gameCreateRequestDTO) {
return GameDTO.of(gameRepository.save(gameCreateRequestDTO.toDAO()));
private final UserGetByIdSmallBean userGetByIdSmallBean;
public GameCreateResultDTO exec(GameCreateRequestDTO gameCreateRequestDTO) {
UserDAO findUser = userGetByIdSmallBean.exec(gameCreateRequestDTO.getUserId());

GameDAO newGame = gameCreateRequestDTO.toDAO();

newGame.setUser(findUser);

return GameCreateResultDTO.of(gameRepository.save(newGame));
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package com.example.jsgamesbackendmain.Bean.HelpfulBean;

import com.example.jsgamesbackendmain.Bean.SmallBean.HelpfulBean.HelpfulDeleteSmallBean;
import com.example.jsgamesbackendmain.Bean.SmallBean.ReviewBean.ReviewGetByIdSmallBean;
import com.example.jsgamesbackendmain.Bean.SmallBean.UserBean.UserGetByIdSmallBean;
import com.example.jsgamesbackendmain.Model.DAO.ReviewDAO;
import com.example.jsgamesbackendmain.Model.DAO.UserDAO;
import com.example.jsgamesbackendmain.Model.DTO.StateResponseDTO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
Expand All @@ -9,9 +13,14 @@
@RequiredArgsConstructor
public class HelpfulDeleteBean {
private final HelpfulDeleteSmallBean helpfulDeleteSmallBean;
private final UserGetByIdSmallBean userGetByIdSmallBean;
private final ReviewGetByIdSmallBean reviewGetByIdSmallBean;

public StateResponseDTO exec(String userId, Long reviewId) {
helpfulDeleteSmallBean.exec(userId, reviewId);
UserDAO findUser = userGetByIdSmallBean.exec(userId);
ReviewDAO findReview = reviewGetByIdSmallBean.exec(reviewId);

helpfulDeleteSmallBean.exec(findUser, findReview);
return new StateResponseDTO(true);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package com.example.jsgamesbackendmain.Bean.HelpfulBean;

import com.example.jsgamesbackendmain.Bean.SmallBean.HelpfulBean.HelpfulGetSmallBean;
import com.example.jsgamesbackendmain.Bean.SmallBean.ReviewBean.ReviewGetByIdSmallBean;
import com.example.jsgamesbackendmain.Bean.SmallBean.UserBean.UserGetByIdSmallBean;
import com.example.jsgamesbackendmain.Model.DAO.ReviewDAO;
import com.example.jsgamesbackendmain.Model.DAO.UserDAO;
import com.example.jsgamesbackendmain.Model.DTO.Helpful.HelpfulGetResponseDTO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
Expand All @@ -9,9 +13,14 @@
@RequiredArgsConstructor
public class HelpfulGetBean {
private final HelpfulGetSmallBean helpfulGetSmallBean;
private final UserGetByIdSmallBean userGetByIdSmallBean;
private final ReviewGetByIdSmallBean reviewGetByIdSmallBean;

public HelpfulGetResponseDTO exec(String userId, Long reviewId) {
boolean exec = helpfulGetSmallBean.exec(userId, reviewId);
UserDAO findUser = userGetByIdSmallBean.exec(userId);
ReviewDAO findReview = reviewGetByIdSmallBean.exec(reviewId);

boolean exec = helpfulGetSmallBean.exec(findUser, findReview);


return HelpfulGetResponseDTO.builder()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package com.example.jsgamesbackendmain.Bean.HelpfulBean;

import com.example.jsgamesbackendmain.Bean.SmallBean.HelpfulBean.HelpfulPostSmallBean;
import com.example.jsgamesbackendmain.Bean.SmallBean.ReviewBean.ReviewGetByIdSmallBean;
import com.example.jsgamesbackendmain.Bean.SmallBean.UserBean.UserGetByIdSmallBean;
import com.example.jsgamesbackendmain.Model.DAO.ReviewDAO;
import com.example.jsgamesbackendmain.Model.DAO.UserDAO;
import com.example.jsgamesbackendmain.Model.DTO.StateResponseDTO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
Expand All @@ -10,6 +14,7 @@
public class HelpfulPostBean {
private final HelpfulPostSmallBean helpfulPostSmallBean;
public StateResponseDTO exec(String userId, Long reviewId) {

helpfulPostSmallBean.exec(userId, reviewId);
return new StateResponseDTO(true);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.example.jsgamesbackendmain.Bean.ImageBean;

import com.example.jsgamesbackendmain.Bean.SmallBean.ImageBean.S3SetSmallBean;
import com.example.jsgamesbackendmain.Model.DTO.StateResponseDTO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

@Component
@RequiredArgsConstructor
public class S3SetImageBean {
private final S3SetSmallBean s3SetSmallBean;

public StateResponseDTO exec() {
s3SetSmallBean.exec();
return new StateResponseDTO(true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public LogGetByGameIdUserIdResponseDTO exec(Long gameId, String userId) {
UserDAO userDAO = userGetByIdSmallBean.exec(userId);

// LogDAO 조회
LogDAO logDAO = logGetByGameIdUserIdSmallBean.exec(gameDAO, userId);
LogDAO logDAO = logGetByGameIdUserIdSmallBean.exec(gameDAO, userDAO);

// rank 조회
Long rank = logGetRankSmallBean.exec(gameDAO, logDAO);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
import com.example.jsgamesbackendmain.Bean.SmallBean.GameBean.GameGetSmallBean;
import com.example.jsgamesbackendmain.Bean.SmallBean.LogBean.LogGetByGameSmallBean;
import com.example.jsgamesbackendmain.Model.DAO.GameDAO;
import com.example.jsgamesbackendmain.Model.DAO.LogDAO;
import com.example.jsgamesbackendmain.Model.DTO.Log.Response.LogGetByGameIdResponseDTO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.stream.Collectors;

@Component
@RequiredArgsConstructor
Expand All @@ -20,7 +22,9 @@ public List<LogGetByGameIdResponseDTO> exec(Long gameId, Integer page, Integer s

GameDAO gameDAO = gameGetSmallBean.exec(gameId);

return logGetByGameSmallBean.exec(gameDAO, page, size);
return logGetByGameSmallBean.exec(gameDAO, page, size).stream()
.map(LogGetByGameIdResponseDTO::of)
.collect(Collectors.toList());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class LogGetByUserIdBean {

private final UserGetByIdSmallBean userValidationSmallBean;

public List<LogGetByUserIdResponseDTO> exec(String userId, Long page, Long size) {
public List<LogGetByUserIdResponseDTO> exec(String userId, Integer page, Integer size) {

//userId 유효성 확인
UserDAO user = userValidationSmallBean.exec(userId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,23 @@ public class LogPostBean {

public LogPostResponseDTO exec(LogPostRequestDTO logPostRequestDTO) {
// game found
GameDAO game = gameGetSmallBean.exec(logPostRequestDTO.getGameId());
GameDAO findGame = gameGetSmallBean.exec(logPostRequestDTO.getGameId());

// user found
UserDAO user = userValidationSmallBean.exec(logPostRequestDTO.getUserId());

// get top log
Optional<LogGetByGameIdResponseDTO> preTopLog = logGetByGameSmallBean.exec(game, 0, 1).stream().findAny();
UserDAO findUser = userValidationSmallBean.exec(logPostRequestDTO.getUserId());

// log save
LogDAO savedLogDAO = logSaveSmallBean.exec(logPostRequestDTO.toDAO());
LogDAO newLog = logPostRequestDTO.toDAO();
newLog.setGame(findGame);
newLog.setUser(findUser);
LogDAO savedLog = logSaveSmallBean.exec(newLog);

// get top log
Optional<LogGetByGameIdResponseDTO> nextTopLog = logGetByGameSmallBean.exec(game, 0, 1).stream().findAny();

// log catch top change
Boolean isChange = logCatchTopChange.exec(preTopLog, nextTopLog);
Boolean isChange = logCatchTopChange.exec(findGame);
// 여기서 이벤트 처리하면 됨!!!!!

return LogPostResponseDTO.of(savedLogDAO, user);
return LogPostResponseDTO.of(savedLog);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class RankGetBean {
private final RankGetTop100SmallBean rankGetTop100SmallBean;
private final RankLastUpdatedSmallBean rankLastUpdatedSmallBean;

public RankGetResponseDTO exec(Long page, Long size) {
public RankGetResponseDTO exec(Integer page, Integer size) {
// RankTop100 DAO to Rank

return RankGetResponseDTO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ public class RankGetByMajorBean {
private final RankMajorLastUpdatedSmallBean rankMajorLastUpdatedSmallBean;
private final RankGetByMajorSmallBean rankGetByMajorSmallBean;

public RankByMajorGetResponseDTO exec(Major major) {
public RankByMajorGetResponseDTO exec(Integer page, Integer size, Major major) {
return RankByMajorGetResponseDTO
.builder()
.lastUpdated(rankMajorLastUpdatedSmallBean.getLastUpdated())
.rankList(rankGetByMajorSmallBean.exec(major))
.rankList(rankGetByMajorSmallBean.exec(page, size, major))
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.example.jsgamesbackendmain.Bean.SmallBean.GameBean.GameGetSmallBean;
import com.example.jsgamesbackendmain.Bean.SmallBean.ReviewBean.ReviewGetByUserIdAndGameIdSmallBean;
import com.example.jsgamesbackendmain.Bean.SmallBean.UserBean.UserGetByIdSmallBean;
import com.example.jsgamesbackendmain.Model.DAO.GameDAO;
import com.example.jsgamesbackendmain.Model.DAO.ReviewDAO;
import com.example.jsgamesbackendmain.Model.DAO.UserDAO;
import com.example.jsgamesbackendmain.Model.DTO.Review.Response.ReviewGetByGameIdResponseDTO;
Expand All @@ -18,12 +19,12 @@ public class ReviewGetMyReviewBean {

public ReviewGetByGameIdResponseDTO exec(Long gameId, String userId) {

UserDAO user = userGetByIdSmallBean.exec(userId);
UserDAO findUser = userGetByIdSmallBean.exec(userId);

gameGetSmallBean.exec(gameId);
GameDAO findGame = gameGetSmallBean.exec(gameId);

ReviewDAO dao = reviewGetByUserIdAndGameIdSmallBean.exec(userId, gameId);
ReviewDAO findReview = reviewGetByUserIdAndGameIdSmallBean.exec(findUser, findGame);

return ReviewGetByGameIdResponseDTO.of(dao, user);
return ReviewGetByGameIdResponseDTO.of(findReview);
}
}
Loading
Loading