Skip to content

Commit

Permalink
style: config 최신화 및 Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
hongdosan committed Nov 15, 2023
2 parents 2b5afa1 + c28a033 commit f14f345
Show file tree
Hide file tree
Showing 16 changed files with 124 additions and 147 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import com.moabam.api.application.member.MemberService;
import com.moabam.api.domain.bug.BugHistory;
import com.moabam.api.domain.bug.BugType;
import com.moabam.api.domain.bug.repository.BugHistorySearchRepository;
import com.moabam.api.domain.member.Member;
import com.moabam.api.domain.repository.BugHistorySearchRepository;
import com.moabam.api.dto.TodayBugResponse;
import com.moabam.api.dto.bug.BugResponse;
import com.moabam.global.common.util.ClockHolder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public RoomDetailsResponse getRoomDetails(Long memberId, Long roomId) {
}

private List<RoutineResponse> getRoutineResponses(Long roomId) {
List<Routine> roomRoutines = routineSearchRepository.findByRoomId(roomId);
List<Routine> roomRoutines = routineSearchRepository.findAllByRoomId(roomId);

return RoutineMapper.toRoutineResponses(roomRoutines);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void modifyRoom(Long memberId, Long roomId, ModifyRoomRequest modifyRoomR
room.changeCertifyTime(modifyRoomRequest.certifyTime());
room.changeMaxCount(modifyRoomRequest.maxUserCount());

List<Routine> routines = routineSearchRepository.findByRoomId(roomId);
List<Routine> routines = routineSearchRepository.findAllByRoomId(roomId);
routineRepository.deleteAll(routines);

List<Routine> newRoutines = RoutineMapper.toRoutineEntities(room, modifyRoomRequest.routines());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.moabam.api.domain.repository;
package com.moabam.api.domain.bug.repository;

import static com.moabam.api.domain.bug.QBugHistory.*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class RoutineSearchRepository {

private final JPAQueryFactory jpaQueryFactory;

public List<Routine> findByRoomId(Long roomId) {
public List<Routine> findAllByRoomId(Long roomId) {
return jpaQueryFactory
.selectFrom(routine)
.where(
Expand Down
49 changes: 32 additions & 17 deletions src/main/java/com/moabam/api/presentation/RoomController.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import com.moabam.api.dto.room.EnterRoomRequest;
import com.moabam.api.dto.room.ModifyRoomRequest;
import com.moabam.api.dto.room.RoomDetailsResponse;
import com.moabam.global.auth.annotation.CurrentMember;
import com.moabam.global.auth.model.AuthorizationMember;

import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
Expand All @@ -37,50 +39,63 @@ public class RoomController {

@PostMapping
@ResponseStatus(HttpStatus.CREATED)
public Long createRoom(@Valid @RequestBody CreateRoomRequest createRoomRequest) {
return roomService.createRoom(1L, createRoomRequest);
public Long createRoom(@CurrentMember AuthorizationMember authorizationMember,
@Valid @RequestBody CreateRoomRequest createRoomRequest) {

return roomService.createRoom(authorizationMember.id(), createRoomRequest);
}

@PutMapping("/{roomId}")
@ResponseStatus(HttpStatus.OK)
public void modifyRoom(@Valid @RequestBody ModifyRoomRequest modifyRoomRequest,
@PathVariable("roomId") Long roomId) {
roomService.modifyRoom(1L, roomId, modifyRoomRequest);
public void modifyRoom(@CurrentMember AuthorizationMember authorizationMember,
@Valid @RequestBody ModifyRoomRequest modifyRoomRequest, @PathVariable("roomId") Long roomId) {

roomService.modifyRoom(authorizationMember.id(), roomId, modifyRoomRequest);
}

@PostMapping("/{roomId}")
@ResponseStatus(HttpStatus.OK)
public void enterRoom(@PathVariable("roomId") Long roomId, @Valid @RequestBody EnterRoomRequest enterRoomRequest) {
roomService.enterRoom(1L, roomId, enterRoomRequest);
public void enterRoom(@CurrentMember AuthorizationMember authorizationMember, @PathVariable("roomId") Long roomId,
@Valid @RequestBody EnterRoomRequest enterRoomRequest) {

roomService.enterRoom(authorizationMember.id(), roomId, enterRoomRequest);
}

@DeleteMapping("/{roomId}")
@ResponseStatus(HttpStatus.OK)
public void exitRoom(@PathVariable("roomId") Long roomId) {
roomService.exitRoom(1L, roomId);
public void exitRoom(@CurrentMember AuthorizationMember authorizationMember, @PathVariable("roomId") Long roomId) {
roomService.exitRoom(authorizationMember.id(), roomId);
}

@GetMapping("/{roomId}")
@ResponseStatus(HttpStatus.OK)
public RoomDetailsResponse getRoomDetails(@PathVariable("roomId") Long roomId) {
return roomSearchService.getRoomDetails(1L, roomId);
public RoomDetailsResponse getRoomDetails(@CurrentMember AuthorizationMember authorizationMember,
@PathVariable("roomId") Long roomId) {

return roomSearchService.getRoomDetails(authorizationMember.id(), roomId);
}

@PostMapping("/{roomId}/certification")
@ResponseStatus(HttpStatus.CREATED)
public void certifyRoom(@PathVariable("roomId") Long roomId, @RequestPart List<MultipartFile> multipartFiles) {
roomCertificationService.certifyRoom(1L, roomId, multipartFiles);
public void certifyRoom(@CurrentMember AuthorizationMember authorizationMember, @PathVariable("roomId") Long roomId,
@RequestPart List<MultipartFile> multipartFiles) {

roomCertificationService.certifyRoom(authorizationMember.id(), roomId, multipartFiles);
}

@PutMapping("/{roomId}/members/{memberId}/mandate")
@ResponseStatus(HttpStatus.OK)
public void mandateManager(@PathVariable("roomId") Long roomId, @PathVariable("memberId") Long memberId) {
roomService.mandateRoomManager(1L, roomId, memberId);
public void mandateManager(@CurrentMember AuthorizationMember authorizationMember,
@PathVariable("roomId") Long roomId, @PathVariable("memberId") Long memberId) {

roomService.mandateRoomManager(authorizationMember.id(), roomId, memberId);
}

@DeleteMapping("/{roomId}/members/{memberId}")
@ResponseStatus(HttpStatus.OK)
public void deportParticipant(@PathVariable("roomId") Long roomId, @PathVariable("memberId") Long memberId) {
roomService.deportParticipant(1L, roomId, memberId);
public void deportParticipant(@CurrentMember AuthorizationMember authorizationMember,
@PathVariable("roomId") Long roomId, @PathVariable("memberId") Long memberId) {

roomService.deportParticipant(authorizationMember.id(), roomId, memberId);
}
}
2 changes: 1 addition & 1 deletion src/main/resources/config
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.moabam.api.application;
package com.moabam.api.application.room;

import static org.assertj.core.api.Assertions.*;
import static org.mockito.ArgumentMatchers.anyList;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.BDDMockito.*;

import java.time.LocalDate;
Expand All @@ -23,7 +23,6 @@

import com.moabam.api.application.image.ImageService;
import com.moabam.api.application.member.MemberService;
import com.moabam.api.application.room.RoomCertificationService;
import com.moabam.api.domain.image.ImageType;
import com.moabam.api.domain.member.Member;
import com.moabam.api.domain.room.DailyMemberCertification;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.moabam.api.application;
package com.moabam.api.application.room;

import static com.moabam.api.domain.room.RoomType.*;
import static org.assertj.core.api.Assertions.*;
Expand All @@ -17,7 +17,6 @@
import org.mockito.junit.jupiter.MockitoExtension;

import com.moabam.api.application.member.MemberService;
import com.moabam.api.application.room.RoomService;
import com.moabam.api.application.room.mapper.RoomMapper;
import com.moabam.api.domain.member.Member;
import com.moabam.api.domain.room.Participant;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
package com.moabam.api.domain.entity;
package com.moabam.api.domain.room;

import static org.assertj.core.api.Assertions.*;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

import com.moabam.api.domain.room.Certification;
import com.moabam.api.domain.room.Room;
import com.moabam.api.domain.room.RoomType;
import com.moabam.api.domain.room.Routine;

class CertificationTest {

String content = "물 마시기";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.moabam.api.domain.entity;
package com.moabam.api.domain.room;

import static org.assertj.core.api.Assertions.*;

Expand All @@ -7,8 +7,6 @@
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;

import com.moabam.api.domain.room.Room;
import com.moabam.api.domain.room.RoomType;
import com.moabam.global.error.exception.BadRequestException;
import com.moabam.global.error.model.ErrorMessage;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.moabam.api.domain.repository;
package com.moabam.api.domain.room.repository;

import static org.assertj.core.api.Assertions.*;

Expand All @@ -16,13 +16,6 @@
import com.moabam.api.domain.room.Participant;
import com.moabam.api.domain.room.Room;
import com.moabam.api.domain.room.Routine;
import com.moabam.api.domain.room.repository.CertificationRepository;
import com.moabam.api.domain.room.repository.CertificationsSearchRepository;
import com.moabam.api.domain.room.repository.DailyMemberCertificationRepository;
import com.moabam.api.domain.room.repository.DailyRoomCertificationRepository;
import com.moabam.api.domain.room.repository.ParticipantRepository;
import com.moabam.api.domain.room.repository.RoomRepository;
import com.moabam.api.domain.room.repository.RoutineRepository;
import com.moabam.support.annotation.QuerydslRepositoryTest;
import com.moabam.support.fixture.RoomFixture;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.moabam.api.domain.repository;
package com.moabam.api.domain.room.repository;

import static org.assertj.core.api.Assertions.*;

Expand All @@ -13,9 +13,6 @@

import com.moabam.api.domain.room.Participant;
import com.moabam.api.domain.room.Room;
import com.moabam.api.domain.room.repository.ParticipantRepository;
import com.moabam.api.domain.room.repository.ParticipantSearchRepository;
import com.moabam.api.domain.room.repository.RoomRepository;
import com.moabam.global.config.JpaConfig;

@DataJpaTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import com.moabam.api.application.bug.BugMapper;
import com.moabam.api.application.member.MemberService;
import com.moabam.api.domain.bug.repository.BugHistoryRepository;
import com.moabam.api.domain.repository.BugHistorySearchRepository;
import com.moabam.api.domain.bug.repository.BugHistorySearchRepository;
import com.moabam.api.dto.TodayBugResponse;
import com.moabam.api.dto.bug.BugResponse;
import com.moabam.support.annotation.WithMember;
Expand Down
Loading

0 comments on commit f14f345

Please sign in to comment.