Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -8,6 +8,8 @@
import com.back.domain.mentoring.mentoring.service.MentoringService;
import com.back.global.rq.Rq;
import com.back.global.rsData.RsData;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
Expand All @@ -17,11 +19,13 @@
@RestController
@RequestMapping("/mentoring")
@RequiredArgsConstructor
@Tag(name = "MentoringController", description = "멘토링 API")
public class MentoringController {
private final MentoringService mentoringService;
private final Rq rq;

@GetMapping
@Operation(summary = "멘토링 목록 조회")
public RsData<MentoringPagingResponse> getMentorings(
@RequestParam(defaultValue = "0") int page,
@RequestParam(defaultValue = "10") int size,
Expand All @@ -38,6 +42,7 @@ public RsData<MentoringPagingResponse> getMentorings(
}

@GetMapping("/{mentoringId}")
@Operation(summary = "멘토링 상세 조회")
public RsData<MentoringResponse> getMentoring(
@PathVariable Long mentoringId
) {
Expand All @@ -52,6 +57,7 @@ public RsData<MentoringResponse> getMentoring(

@PostMapping
@PreAuthorize("hasRole('MENTOR')")
@Operation(summary = "멘토링 생성")
public RsData<MentoringResponse> createMentoring(
@RequestBody @Valid MentoringRequest reqDto
) {
Expand All @@ -66,6 +72,7 @@ public RsData<MentoringResponse> createMentoring(
}

@PutMapping("/{mentoringId}")
@Operation(summary = "멘토링 수정")
public RsData<MentoringResponse> updateMentoring(
@PathVariable Long mentoringId,
@RequestBody @Valid MentoringRequest reqDto
Expand All @@ -81,6 +88,7 @@ public RsData<MentoringResponse> updateMentoring(
}

@DeleteMapping("/{mentoringId}")
@Operation(summary = "멘토링 삭제")
public RsData<Void> deleteMentoring(
@PathVariable Long mentoringId
) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
package com.back.domain.mentoring.mentoring.dto.response;

import com.back.domain.mentoring.mentoring.dto.MentoringDto;
import io.swagger.v3.oas.annotations.media.Schema;
import org.springframework.data.domain.Page;

import java.util.List;

public record MentoringPagingResponse(
@Schema(description = "멘토링 목록")
List<MentoringDto> mentorings,
@Schema(description = "현재 페이지 (0부터 시작)")
int currentPage,
@Schema(description = "총 페이지")
int totalPage,
@Schema(description = "총 개수")
long totalElements,
@Schema(description = "다음 페이지 존재 여부")
boolean hasNext
) {
public static MentoringPagingResponse from(Page<MentoringDto> page) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@

import com.back.domain.member.mentor.dto.MentorDto;
import com.back.domain.mentoring.mentoring.dto.MentoringDetailDto;
import io.swagger.v3.oas.annotations.media.Schema;

public record MentoringResponse(
@Schema(description = "멘토링")
MentoringDetailDto mentoring,
@Schema(description = "멘토")
MentorDto mentor
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import com.back.domain.mentoring.slot.service.MentorSlotService;
import com.back.global.rq.Rq;
import com.back.global.rsData.RsData;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
Expand All @@ -14,13 +16,15 @@
@RestController
@RequestMapping("/mentor-slot")
@RequiredArgsConstructor
@Tag(name = "MentorSlotController", description = "멘토 슬롯(멘토의 예약 가능 일정) API")
public class MentorSlotController {

private final MentorSlotService mentorSlotService;
private final Rq rq;

@PostMapping
@PreAuthorize("hasRole('MENTOR')")
@Operation(summary = "멘토 슬롯 생성")
public RsData<MentorSlotResponse> createMentorSlot(
@RequestBody @Valid MentorSlotRequest reqDto
) {
Expand All @@ -35,6 +39,7 @@ public RsData<MentorSlotResponse> createMentorSlot(
}

@PutMapping("/{slotId}")
@Operation(summary = "멘토 슬롯 수정")
public RsData<MentorSlotResponse> updateMentorSlot(
@PathVariable Long slotId,
@RequestBody @Valid MentorSlotRequest reqDto
Expand Down