Skip to content

Commit 81a6e9c

Browse files
author
github-actions
committed
chore: Java 스타일 수정
1 parent 1bd3f28 commit 81a6e9c

File tree

2 files changed

+56
-55
lines changed

2 files changed

+56
-55
lines changed

backend/src/main/java/io/f1/backend/domain/game/app/RoomService.java

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public void enterRoom(RoomValidationRequest request) {
110110
}
111111

112112
if (room.getRoomSetting().locked()
113-
&& !room.getRoomSetting().password().equals(request.password())) {
113+
&& !room.getRoomSetting().password().equals(request.password())) {
114114
throw new CustomException(RoomErrorCode.WRONG_PASSWORD);
115115
}
116116

@@ -119,7 +119,7 @@ public void enterRoom(RoomValidationRequest request) {
119119
}
120120

121121
public RoomInitialData initializeRoomSocket(
122-
Long roomId, String sessionId, UserPrincipal principal) {
122+
Long roomId, String sessionId, UserPrincipal principal) {
123123

124124
Room room = findRoom(roomId);
125125

@@ -145,15 +145,15 @@ public RoomInitialData initializeRoomSocket(
145145
Quiz quiz = quizService.getQuizWithQuestionsById(quizId);
146146

147147
GameSettingResponse gameSettingResponse =
148-
toGameSettingResponse(room.getGameSetting(), quiz);
148+
toGameSettingResponse(room.getGameSetting(), quiz);
149149

150150
PlayerListResponse playerListResponse = toPlayerListResponse(room);
151151

152152
SystemNoticeResponse systemNoticeResponse =
153-
ofPlayerEvent(player.getNickname(), RoomEventType.ENTER);
153+
ofPlayerEvent(player.getNickname(), RoomEventType.ENTER);
154154

155155
return new RoomInitialData(
156-
roomSettingResponse, gameSettingResponse, playerListResponse, systemNoticeResponse);
156+
roomSettingResponse, gameSettingResponse, playerListResponse, systemNoticeResponse);
157157
}
158158

159159
public RoomExitData exitRoom(Long roomId, String sessionId, UserPrincipal principal) {
@@ -179,7 +179,7 @@ public RoomExitData exitRoom(Long roomId, String sessionId, UserPrincipal princi
179179
removePlayer(room, sessionId, removePlayer);
180180

181181
SystemNoticeResponse systemNoticeResponse =
182-
ofPlayerEvent(removePlayer.nickname, RoomEventType.EXIT);
182+
ofPlayerEvent(removePlayer.nickname, RoomEventType.EXIT);
183183

184184
PlayerListResponse playerListResponse = toPlayerListResponse(room);
185185

@@ -189,9 +189,9 @@ public RoomExitData exitRoom(Long roomId, String sessionId, UserPrincipal princi
189189

190190
public PlayerListResponse handlePlayerReady(Long roomId, String sessionId) {
191191
Player player =
192-
roomRepository
193-
.findPlayerInRoomBySessionId(roomId, sessionId)
194-
.orElseThrow(() -> new CustomException(RoomErrorCode.PLAYER_NOT_FOUND));
192+
roomRepository
193+
.findPlayerInRoomBySessionId(roomId, sessionId)
194+
.orElseThrow(() -> new CustomException(RoomErrorCode.PLAYER_NOT_FOUND));
195195

196196
player.toggleReady();
197197

@@ -203,15 +203,15 @@ public PlayerListResponse handlePlayerReady(Long roomId, String sessionId) {
203203
public RoomListResponse getAllRooms() {
204204
List<Room> rooms = roomRepository.findAll();
205205
List<RoomResponse> roomResponses =
206-
rooms.stream()
207-
.map(
208-
room -> {
209-
Long quizId = room.getGameSetting().getQuizId();
210-
Quiz quiz = quizService.getQuizWithQuestionsById(quizId);
211-
212-
return toRoomResponse(room, quiz);
213-
})
214-
.toList();
206+
rooms.stream()
207+
.map(
208+
room -> {
209+
Long quizId = room.getGameSetting().getQuizId();
210+
Quiz quiz = quizService.getQuizWithQuestionsById(quizId);
211+
212+
return toRoomResponse(room, quiz);
213+
})
214+
.toList();
215215
return new RoomListResponse(roomResponses);
216216
}
217217

@@ -234,12 +234,12 @@ public RoundResult chat(Long roomId, String sessionId, ChatMessage chatMessage)
234234
room.increasePlayerCorrectCount(sessionId);
235235

236236
return RoundResult.builder()
237-
.questionResult(
238-
toQuestionResultResponse(currentQuestion.getId(), chatMessage, answer))
239-
.rankUpdate(toRankUpdateResponse(room))
240-
.systemNotice(ofPlayerEvent(chatMessage.nickname(), RoomEventType.ENTER))
241-
.chat(chatMessage)
242-
.build();
237+
.questionResult(
238+
toQuestionResultResponse(currentQuestion.getId(), chatMessage, answer))
239+
.rankUpdate(toRankUpdateResponse(room))
240+
.systemNotice(ofPlayerEvent(chatMessage.nickname(), RoomEventType.ENTER))
241+
.chat(chatMessage)
242+
.build();
243243
}
244244

245245
private Player getRemovePlayer(Room room, String sessionId, UserPrincipal principal) {
@@ -261,8 +261,8 @@ private Player createPlayer() {
261261

262262
private Room findRoom(Long roomId) {
263263
return roomRepository
264-
.findRoom(roomId)
265-
.orElseThrow(() -> new CustomException(RoomErrorCode.ROOM_NOT_FOUND));
264+
.findRoom(roomId)
265+
.orElseThrow(() -> new CustomException(RoomErrorCode.ROOM_NOT_FOUND));
266266
}
267267

268268
private boolean isLastPlayer(Room room, String sessionId) {
@@ -282,14 +282,14 @@ private void changeHost(Room room, String hostSessionId) {
282282
Map<String, Player> playerSessionMap = room.getPlayerSessionMap();
283283

284284
Optional<String> nextHostSessionId =
285-
playerSessionMap.keySet().stream()
286-
.filter(key -> !key.equals(hostSessionId))
287-
.findFirst();
285+
playerSessionMap.keySet().stream()
286+
.filter(key -> !key.equals(hostSessionId))
287+
.findFirst();
288288

289289
Player nextHost =
290-
playerSessionMap.get(
291-
nextHostSessionId.orElseThrow(
292-
() -> new CustomException(RoomErrorCode.SOCKET_SESSION_NOT_FOUND)));
290+
playerSessionMap.get(
291+
nextHostSessionId.orElseThrow(
292+
() -> new CustomException(RoomErrorCode.SOCKET_SESSION_NOT_FOUND)));
293293

294294
room.updateHost(nextHost);
295295
log.info("user_id:{} 방장 변경 완료 ", nextHost.getId());
@@ -303,4 +303,4 @@ private void removePlayer(Room room, String sessionId, Player removePlayer) {
303303
private RoundResult buildResultOnlyChat(ChatMessage chatMessage) {
304304
return RoundResult.builder().chat(chatMessage).build();
305305
}
306-
}
306+
}

backend/src/main/java/io/f1/backend/domain/quiz/app/QuizService.java

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ private String getExtension(String filename) {
122122
public void deleteQuiz(Long quizId) {
123123

124124
Quiz quiz =
125-
quizRepository
126-
.findById(quizId)
127-
.orElseThrow(() -> new CustomException(QuizErrorCode.QUIZ_NOT_FOUND));
125+
quizRepository
126+
.findById(quizId)
127+
.orElseThrow(() -> new CustomException(QuizErrorCode.QUIZ_NOT_FOUND));
128128

129129
// TODO : util 메서드에서 사용자 ID 꺼내쓰는 식으로 수정하기
130130
if (1L != quiz.getCreator().getId()) {
@@ -138,9 +138,9 @@ public void deleteQuiz(Long quizId) {
138138
@Transactional
139139
public void updateQuizTitle(Long quizId, String title) {
140140
Quiz quiz =
141-
quizRepository
142-
.findById(quizId)
143-
.orElseThrow(() -> new CustomException(QuizErrorCode.QUIZ_NOT_FOUND));
141+
quizRepository
142+
.findById(quizId)
143+
.orElseThrow(() -> new CustomException(QuizErrorCode.QUIZ_NOT_FOUND));
144144

145145
validateTitle(title);
146146
quiz.changeTitle(title);
@@ -150,9 +150,9 @@ public void updateQuizTitle(Long quizId, String title) {
150150
public void updateQuizDesc(Long quizId, String description) {
151151

152152
Quiz quiz =
153-
quizRepository
154-
.findById(quizId)
155-
.orElseThrow(() -> new CustomException(QuizErrorCode.QUIZ_NOT_FOUND));
153+
quizRepository
154+
.findById(quizId)
155+
.orElseThrow(() -> new CustomException(QuizErrorCode.QUIZ_NOT_FOUND));
156156

157157
validateDesc(description);
158158
quiz.changeDescription(description);
@@ -162,9 +162,9 @@ public void updateQuizDesc(Long quizId, String description) {
162162
public void updateThumbnail(Long quizId, MultipartFile thumbnailFile) {
163163

164164
Quiz quiz =
165-
quizRepository
166-
.findById(quizId)
167-
.orElseThrow(() -> new CustomException(QuizErrorCode.QUIZ_NOT_FOUND));
165+
quizRepository
166+
.findById(quizId)
167+
.orElseThrow(() -> new CustomException(QuizErrorCode.QUIZ_NOT_FOUND));
168168

169169
validateImageFile(thumbnailFile);
170170
String newThumbnailPath = convertToThumbnailPath(thumbnailFile);
@@ -230,9 +230,9 @@ public QuizListPageResponse getQuizzes(String title, String creator, Pageable pa
230230
@Transactional(readOnly = true)
231231
public Quiz getQuizWithQuestionsById(Long quizId) {
232232
Quiz quiz =
233-
quizRepository
234-
.findQuizWithQuestionsById(quizId)
235-
.orElseThrow(() -> new CustomException(QuizErrorCode.QUIZ_NOT_FOUND));
233+
quizRepository
234+
.findQuizWithQuestionsById(quizId)
235+
.orElseThrow(() -> new CustomException(QuizErrorCode.QUIZ_NOT_FOUND));
236236
return quiz;
237237
}
238238

@@ -244,18 +244,18 @@ public QuizMinData getQuizMinData() {
244244
@Transactional(readOnly = true)
245245
public QuizQuestionListResponse getQuizWithQuestions(Long quizId) {
246246
Quiz quiz =
247-
quizRepository
248-
.findById(quizId)
249-
.orElseThrow(() -> new CustomException(QuizErrorCode.QUIZ_NOT_FOUND));
247+
quizRepository
248+
.findById(quizId)
249+
.orElseThrow(() -> new CustomException(QuizErrorCode.QUIZ_NOT_FOUND));
250250

251251
return quizToQuizQuestionListResponse(quiz);
252252
}
253253

254254
@Transactional(readOnly = true)
255255
public List<Question> getRandomQuestionsWithoutAnswer(Long quizId, Integer round) {
256256
quizRepository
257-
.findById(quizId)
258-
.orElseThrow(() -> new NoSuchElementException("존재하지 않는 퀴즈입니다."));
257+
.findById(quizId)
258+
.orElseThrow(() -> new NoSuchElementException("존재하지 않는 퀴즈입니다."));
259259

260260
List<Question> randomQuestions = quizRepository.findRandQuestionsByQuizId(quizId, round);
261261

@@ -264,7 +264,8 @@ public List<Question> getRandomQuestionsWithoutAnswer(Long quizId, Integer round
264264

265265
@Transactional(readOnly = true)
266266
public Quiz findQuizById(Long quizId) {
267-
return quizRepository.findById(quizId)
268-
.orElseThrow(() -> new CustomException(QuizErrorCode.QUIZ_NOT_FOUND));
267+
return quizRepository
268+
.findById(quizId)
269+
.orElseThrow(() -> new CustomException(QuizErrorCode.QUIZ_NOT_FOUND));
269270
}
270271
}

0 commit comments

Comments
 (0)