Skip to content

Commit

Permalink
[#6] fix: 수락 및 신청 URI 변경
Browse files Browse the repository at this point in the history
- 자원의 위치를 표현하도록 수정합니다.
  • Loading branch information
YehyeokBang committed Oct 13, 2024
1 parent b7cbea2 commit f187723
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,41 +20,43 @@ public class GatheringController implements GatheringApiDocs {

private final GatheringService gatheringService;

@GetMapping()
@GetMapping
public GatheringListResponseDto findGatheringList(Principal principal,
@RequestParam("si") String si,
@RequestParam("dong") String dong,
@RequestParam("gu") String gu) {
return gatheringService.getGatheringByPlace(si, dong, gu);
}

@PostMapping()
@PostMapping
public GatheringResponseDto createGathering(Principal principal,
@RequestBody GatheringDto gatheringDto) {
Long userId = getUserId(principal);
return gatheringService.createGathering(userId, gatheringDto);
}

@PutMapping({"{gatheringId}"})
@PutMapping("{gatheringId}")
public GatheringResponseDto modifyGatheringByHost(Principal principal,
@PathVariable("gatheringId") Long gatheringId,
@RequestBody GatheringDto gatheringDto) {
Long userId = getUserId(principal);
return gatheringService.modifyGatheringInfoByHost(userId, gatheringId, gatheringDto);
}

@PostMapping("success")
@PostMapping("{gatheringId}/success")
public GatheringClosedResponse successGatheringByHost(Principal principal,
@PathVariable("gatheringId") Long gatheringId,
GatheringSuccessDto successDto) {
Long userId = getUserId(principal);
return gatheringService.successGatheringByHost(userId, successDto);
return gatheringService.successGatheringByHost(userId, gatheringId, successDto);
}

@PostMapping("cancel")
@PostMapping("{gatheringId}/cancel")
public GatheringClosedResponse cancelGatheringByHost(Principal principal,
@PathVariable("gatheringId") Long gatheringId,
GatheringCancelDto cancelDto) {
Long userId = getUserId(principal);
return gatheringService.cancelGatheringByHost(userId, cancelDto);
return gatheringService.cancelGatheringByHost(userId, gatheringId, cancelDto);
}

private Long getUserId(Principal principal) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ GatheringResponseDto modifyGatheringByHost(Principal principal,
description = "유효하지 않은 코드가 전달되었을 때"
)
})
GatheringClosedResponse cancelGatheringByHost(Principal principal, GatheringCancelDto cancelDto);
GatheringClosedResponse cancelGatheringByHost(Principal principal,
Long gatheringId,
GatheringCancelDto cancelDto);

@Operation(summary = "모임 성공적 종료")
@ApiResponses(value = {
Expand All @@ -81,5 +83,7 @@ GatheringResponseDto modifyGatheringByHost(Principal principal,
description = "유효하지 않은 코드가 전달되었을 때"
)
})
GatheringClosedResponse successGatheringByHost(Principal principal, GatheringSuccessDto successDto);
GatheringClosedResponse successGatheringByHost(Principal principal,
Long gatheringId,
GatheringSuccessDto successDto);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import dev.office.networkoffice.gathering.domain.ReasonForCanceled;

public record GatheringCancelDto(
Long gatheringId,
ReasonForCanceled reason
) {
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package dev.office.networkoffice.gathering.controller.dto.request;

public record GatheringSuccessDto(
Long gatheringId,
String review,
Integer star) {
Integer star
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ public GatheringResponseDto modifyGatheringInfoByHost(Long hostId, Long gatherin
}

@Transactional
public GatheringClosedResponse successGatheringByHost(Long hostId, GatheringSuccessDto successDto) {
Gathering gathering = verifyHostAndFindGathering(hostId, successDto.gatheringId());
public GatheringClosedResponse successGatheringByHost(Long hostId, Long gatheringId, GatheringSuccessDto successDto) {
Gathering gathering = verifyHostAndFindGathering(hostId, gatheringId);
gathering.changeStatusToSuccessFul(successDto.review(), successDto.star());

return GatheringClosedResponse.from(gathering.getGatheringStatus().name());
Expand All @@ -86,8 +86,8 @@ public GatheringClosedResponse successGatheringByHost(Long hostId, GatheringSucc
* 모임 파토. 호스트만 지울 수 있고, 지우기 전에 사유를 기록해야됨.
*/
@Transactional
public GatheringClosedResponse cancelGatheringByHost(Long hostId, GatheringCancelDto cancelDto) {
Gathering gathering = verifyHostAndFindGathering(hostId, cancelDto.gatheringId());
public GatheringClosedResponse cancelGatheringByHost(Long hostId, Long gatheringId, GatheringCancelDto cancelDto) {
Gathering gathering = verifyHostAndFindGathering(hostId, gatheringId);
gathering.changeStatusToCancel(cancelDto.reason());

return GatheringClosedResponse.from(gathering.getGatheringStatus().name());
Expand Down

0 comments on commit f187723

Please sign in to comment.