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

๐Ÿงช [Test] && ๐Ÿ› [Bug] ๋ฐฉ ์‹œ์ž‘ํ•˜๊ธฐ ๋ฐ ์ฐธ์—ฌํ•˜๊ธฐ์—์„œ ์‹œ์ž‘๋˜๋Š” ๋ถ€๋ถ„ ํ…Œ์ŠคํŠธ ์ฝ”๋“œ ์ž‘์„ฑ && ๋งˆ๊ฐ๋œ ๋ฐฉ && Finish๋ฐฉ Intra์กฐํšŒ #768

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
11 commits
Select commit Hold shift + click to select a range
b0a7591
[refactoring] ๋ฐ˜๋ณต๋˜๋Š” ๊ตฌ๋ฌธ๋“ค for๋ฌธ์œผ๋กœ ์ˆ˜์ •
AreSain Mar 25, 2024
6690574
[bug] Finish๋œ ๋ฐฉ ์ƒ์„ธ์กฐํšŒ ์•ˆ๋˜๋˜ ๋ฒ„๊ทธ ์ˆ˜์ •
AreSain Mar 25, 2024
d0ed0fd
[bug] ๋งˆ์ง€๋ง‰ ์‚ฌ๋žŒ์ด ๋‚˜๊ฐ€๋ฉด ๋ฐฉ์žฅ์ด๊ถŒ ์•ˆ๋˜๋˜ ๋ฒ„๊ทธ ์ˆ˜์ •
AreSain Mar 25, 2024
919e9ef
[refactoring] [test] ๋ฐฉ ์ƒ์„ธ์กฐํšŒ ์ผ€์ด์Šค ์ถ”๊ฐ€ ๋ฐ ์ฝ”๋“œ ๋ฆฌํŒฉํ† ๋ง
AreSain Mar 25, 2024
f93c97a
[test] ์ฐธ์—ฌ๋กœ ์ธํ•œ ์ตœ๋Œ€์ธ์›์œผ๋กœ ์‹œ์ž‘ํ•˜๋Š” ํ…Œ์ŠคํŠธ ์ฝ”๋“œ ์ž‘์„ฑ
AreSain Mar 25, 2024
6e4312e
[fix] ์‹ค์ˆ˜ ์ˆ˜์ •
AreSain Mar 25, 2024
80053f6
[test] ๋ฐฉ ์‹œ์ž‘ ํ…Œ์ŠคํŠธ ์ฝ”๋“œ ์ž‘์„ฑ
AreSain Mar 25, 2024
667af8f
[fix] ์—๋Ÿฌ์ฝ”๋“œ ์•Œ๋งž๊ฒŒ ์ˆ˜์ •
AreSain Mar 25, 2024
02f6c9f
[test] FINISH๋œ ๋ฐฉ 10๊ฐœ๊นŒ์ง€ ์กฐํšŒํ•˜๋Š” ๊ธฐ๋Šฅ ๋ฐ ํ…Œ์ŠคํŠธ์ฝ”๋“œ ์ถ”๊ฐ€
AreSain Mar 25, 2024
3bd9215
[bug] ์Šค์ผ€์ค„๋Ÿฌ Finish ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์ˆ˜์ •
AreSain Mar 25, 2024
5f06c17
[fix] ์‹ค์ˆ˜ ์ˆ˜์ •
AreSain Mar 25, 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 @@ -25,11 +25,11 @@ public class RoomStatusService {
@Transactional
public void finishStartedRooms() {
LocalDateTime twoHoursAgo = LocalDateTime.now().minusHours(2);
List<Room> startedRooms = roomRepository.findByStatus(RoomType.START, null);
List<Room> startedRooms = roomRepository.findByStatusAndStartDate(RoomType.START, twoHoursAgo);
for (Room room : startedRooms) {
room.updateRoomStatus(RoomType.FINISH);
roomRepository.save(room);
log.info("Room {} status updated to FINISH", room.getId());
log.info("{}๋ฒˆ ๋ฐฉ์ด ์ข…๋ฃŒ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.", room.getId());
}
}

Expand All @@ -45,7 +45,7 @@ public void failOpenedRooms() {
if (room.getDueDate().isBefore(now)) {
room.updateRoomStatus(RoomType.FAIL);
roomRepository.save(room);
log.info("Room {} status updated to FAIL", room.getId());
log.info("{}๋ฒˆ ๋ฐฉ์ด ์‹œ๊ฐ„์ด ์ง€๋‚˜ Fail๋˜์—ˆ์Šต๋‹ˆ๋‹ค.", room.getId());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import javax.transaction.Transactional;

Expand Down Expand Up @@ -44,9 +45,15 @@ public RoomListResDto findRoomList() {

List<Room> notStartedRooms = roomRepository.findByStatus(RoomType.OPEN, sortForNotStarted);
List<Room> startedRooms = roomRepository.findByStatus(RoomType.START, sortForStarted);
List<Room> finishRooms = roomRepository.findByStatus(RoomType.FINISH, sortForStarted);

notStartedRooms.addAll(startedRooms);
List<RoomResDto> roomListResDto = notStartedRooms.stream()
List<Room> limitedFinishRooms = finishRooms.stream().limit(10).collect(Collectors.toList());

List<Room> combinedRooms = Stream.of(notStartedRooms, startedRooms, limitedFinishRooms)
.flatMap(List::stream)
.collect(Collectors.toList());

List<RoomResDto> roomListResDto = combinedRooms.stream()
.map(RoomResDto::new)
.collect(Collectors.toList());

Expand Down Expand Up @@ -126,7 +133,8 @@ public RoomDetailResDto findRoomDetail(Long userId, Long roomId) {
room.getHost().getId(), roomId);
String hostNickname = hostUserRoomOptional.get().getNickname();

if (room.getStatus() == RoomType.START && userRoomOptional.isPresent()) {
if ((room.getStatus() == RoomType.START || room.getStatus() == RoomType.FINISH)
&& userRoomOptional.isPresent()) {
List<CommentResDto> comments = commentRepository.findByRoomId(roomId).stream()
.map(comment -> new CommentResDto(comment, comment.getUser().getIntraId()))
.collect(Collectors.toList());
Expand All @@ -137,7 +145,7 @@ public RoomDetailResDto findRoomDetail(Long userId, Long roomId) {
userRoom.getUser().getImageUri()))
.collect(Collectors.toList());
return new RoomDetailResDto(room, myNickname, hostNickname, roomUsers, comments);
} else { // if ์ฐธ์—ฌ์ž && ์‹œ์ž‘ํ–ˆ์„๊ฒฝ์šฐ intraID || else intraId == null
} else { // if ์ฐธ์—ฌ์ž && Start or Finish ์ƒํƒœ์ธ ๊ฒฝ์šฐ intraID || else intraId == null
List<CommentResDto> comments = commentRepository.findByRoomId(roomId).stream()
.map(CommentResDto::new)
.collect(Collectors.toList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,11 @@ public LeaveRoomResDto modifyLeaveRoom(Long roomId, UserDto user) {
// ๋ฐฉ์žฅ ์ด๊ถŒ
if (user.getId().equals(targetRoom.getHost().getId())) {
List<User> existUser = userRoomRepository.findByIsExist(roomId);
targetRoom.updateHost(existUser.get(0));
if (existUser != null && !existUser.isEmpty()) {
targetRoom.updateHost(existUser.get(0));
} else {
targetRoom.updateHost(null);
}
}
userRoomRepository.save(targetUserRoom);
roomRepository.save(targetRoom);
Expand All @@ -127,14 +131,13 @@ public LeaveRoomResDto modifyLeaveRoom(Long roomId, UserDto user) {
/**
* ๋ฐฉ์„ ์‹œ์ž‘ ์ƒํƒœ๋กœ ๋ฐ”๊พผ๋‹ค
* ๋ฐฉ์˜ ์ƒํƒœ๋ฅผ ์‹œ์ž‘ ์ƒํƒœ๋กœ ๋ณ€๊ฒฝ.
*
* @param roomId, user
* @return ๋ฐฉ id
* @throws RoomNotFoundException ๋ฐฉ ์—†์Œ
* @throws RoomNotOpenException ๋ฐฉ์ด ์—ด๋ฆฌ์ง€ ์•Š์€ ์ƒํƒœ
* @throws RoomNotEnoughPeopleException ๋ฐฉ์— ์ถฉ๋ถ„ํ•œ ์ธ์›์ด ์—†์Œ
* @throws RoomNotParticipantException ๋ฐฉ์— ์ฐธ๊ฐ€ํ•˜์ง€ ์•Š์€ ์œ ์ €
* @throws UserNotHostException ๋ฐฉ์žฅ์ด ์•„๋‹Œ ๊ฒฝ์šฐ
* @throws RoomNotFoundException ๋ฐฉ ์—†์Œ - 404
* @throws RoomNotOpenException ๋ฐฉ์ด ์—ด๋ฆฌ์ง€ ์•Š์€ ์ƒํƒœ - 400
* @throws RoomNotEnoughPeopleException ๋ฐฉ์— ์ถฉ๋ถ„ํ•œ ์ธ์›์ด ์—†์Œ - 400
* @throws RoomNotParticipantException ๋ฐฉ์— ์ฐธ๊ฐ€ํ•˜์ง€ ์•Š์€ ์œ ์ € - 400
* @throws UserNotHostException ๋ฐฉ์žฅ์ด ์•„๋‹Œ ๊ฒฝ์šฐ - 403
*/
@Transactional
public RoomStartResDto modifyStartRoom(Long roomId, UserDto user) {
Expand Down
Loading
Loading