Skip to content

Commit

Permalink
Refactor: Meeting 스웨거 명세 분
Browse files Browse the repository at this point in the history
  • Loading branch information
Moveuk committed Dec 25, 2024
1 parent b876215 commit 04feab2
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

import com.join.core.auth.domain.UserPrincipal;
import com.join.core.common.response.ApiResponse;
import com.join.core.meeting.dto.request.MeetingAppendRequest;
import com.join.core.meeting.dto.response.MeetingResponse;
import com.join.core.meeting.controller.specification.MeetingControllerSpecification;
import com.join.core.meeting.domain.MeetingAppendService;
import com.join.core.meeting.domain.MeetingDeleteService;
import com.join.core.meeting.domain.MeetingReadService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import com.join.core.meeting.dto.request.MeetingAppendRequest;
import com.join.core.meeting.dto.response.MeetingResponse;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
Expand All @@ -21,40 +19,28 @@
@RequiredArgsConstructor
@RestController
@RequestMapping("${api.prefix}/study/{studyToken}/meetings")
public class MeetingController {
public class MeetingController implements MeetingControllerSpecification {

private final MeetingAppendService meetingAppendService;
private final MeetingReadService meetingReadService;
private final MeetingDeleteService meetingDeleteService;

@Tag(name = "${swagger.tag.meeting}")
@Operation(summary = "회차 추가 - 인증 필수",
description = "회차 추가 - 인증 필수",
security = {@SecurityRequirement(name = "session-token")})
@PreAuthorize("isAuthenticated()")
@PostMapping
public ApiResponse<Void> append(@AuthenticationPrincipal UserPrincipal principal,
@Valid @RequestBody MeetingAppendRequest request,
@PathVariable String studyToken
) {
) {
Long avatarId = principal.getAvatarId();
meetingAppendService.appendMeetingToStudy(avatarId, studyToken, request);
return ApiResponse.ok();
}

@Tag(name = "${swagger.tag.meeting}")
@Operation(summary = "회차 리스트 조회",
description = "회차 리스트 조회",
security = {@SecurityRequirement(name = "session-token")})
@GetMapping
public ApiResponse<List<MeetingResponse>> getMeetingDetails(@PathVariable String studyToken) {
return ApiResponse.ok(meetingReadService.getMeetings(studyToken));
}

@Tag(name = "${swagger.tag.meeting}")
@Operation(summary = "회차 삭제 - 인증 필수",
description = "회차 삭제 - 인증 필수",
security = {@SecurityRequirement(name = "session-token")})
@PreAuthorize("isAuthenticated()")
@DeleteMapping("/{meetingId}")
public ApiResponse<Void> delete(@AuthenticationPrincipal UserPrincipal principal,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.join.core.meeting.controller.specification;

import com.join.core.auth.domain.UserPrincipal;
import com.join.core.common.response.ApiResponse;
import com.join.core.meeting.dto.request.MeetingAppendRequest;
import com.join.core.meeting.dto.response.MeetingResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

public interface MeetingControllerSpecification {

@Tag(name = "${swagger.tag.meeting}")
@Operation(summary = "회차 추가 - 인증 필수",
description = "회차 추가 - 인증 필수",
security = {@SecurityRequirement(name = "session-token")})
ApiResponse<Void> append(@AuthenticationPrincipal UserPrincipal principal,
@Valid @RequestBody MeetingAppendRequest request,
@PathVariable String studyToken
);

@Tag(name = "${swagger.tag.meeting}")
@Operation(summary = "회차 리스트 조회",
description = "회차 리스트 조회",
security = {@SecurityRequirement(name = "session-token")})
ApiResponse<List<MeetingResponse>> getMeetingDetails(@PathVariable String studyToken);

@Tag(name = "${swagger.tag.meeting}")
@Operation(summary = "회차 삭제 - 인증 필수",
description = "회차 삭제 - 인증 필수",
security = {@SecurityRequirement(name = "session-token")})
ApiResponse<Void> delete(@AuthenticationPrincipal UserPrincipal principal,
@PathVariable String studyToken,
@PathVariable Long meetingId);
}

0 comments on commit 04feab2

Please sign in to comment.