Skip to content

Commit

Permalink
Merge pull request #70 from mju-facilty-organization/dev
Browse files Browse the repository at this point in the history
[Feat] 스웨거의 요청값 예시를 위한 @Schema, @parameter 처리
  • Loading branch information
0702Yoon authored Feb 26, 2025
2 parents 5e20643 + 7c6fb8a commit 4328420
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
import com.example.rentalSystem.domain.facility.controller.dto.response.FacilityDetailResponse;
import com.example.rentalSystem.domain.facility.controller.dto.response.FacilityResponse;
import com.example.rentalSystem.domain.facility.controller.dto.response.PreSignUrlListResponse;
import com.example.rentalSystem.domain.facility.entity.FacilityType;
import com.example.rentalSystem.global.response.ApiResponse;
import com.example.rentalSystem.global.response.example.ApiErrorCodeExample;
import com.example.rentalSystem.global.response.example.ApiErrorCodeExamples;
import com.example.rentalSystem.global.response.type.ErrorType;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import java.time.LocalDate;
import org.springframework.data.domain.Page;
Expand All @@ -32,11 +34,16 @@ public interface FacilityControllerDocs {
@Operation(summary = "시설 전체 조회 API")
@ApiErrorCodeExample(ErrorType.INVALID_FACILITY_TYPE)
ApiResponse<Page<FacilityResponse>> getAllFacility(
Pageable pageable, String facilityType
@Parameter(example = "{\n"
+ " \"page\": 0,\n"
+ " \"size\": 10\n"
+ "}") Pageable pageable,
@Parameter(example = "본관") String facilityType
);

@Operation(summary = "시설 전체 상세 조회 API")
@Operation(summary = "시설 상세 조회 API")
@ApiErrorCodeExample(ErrorType.ENTITY_NOT_FOUND)
ApiResponse<FacilityDetailResponse> getFacilityDetail(
Long facilityId, LocalDate date);
Long facilityId,
@Parameter(description = "조회할 날짜", example = "YYYY-MM-DD") LocalDate date);
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ public record CreateFacilityRequestDto(
@Schema(description = "최대 수용 인원", example = "30")
Long capacity,
List<String> supportFacilities,
@Schema(description = "시작 시간", example = "YY:MM")
LocalTime startTime,
@Schema(description = "끝 시간", example = "YY:MM")
LocalTime endTime,
@NotEmpty
@Schema(description = "학부", example = "융합소프트웨어학부")
String college,
boolean isAvailable
) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
package com.example.rentalSystem.domain.professor.controller;

import com.example.rentalSystem.domain.professor.controller.dto.response.ProfessorDetailResponse;
import com.example.rentalSystem.global.response.ApiResponse;
import com.example.rentalSystem.global.response.type.SuccessType;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.PageableDefault;
import org.springframework.web.bind.annotation.RequestParam;

@Tag(name = "교수 관련 API", description = "교수 전체 조회 API")
public interface ProfessorControllerDocs {

@Operation(summary = "교수 전체 조회 API")
ApiResponse<?> getAllProfessor(Pageable pageable, String campus, String college,
String major);
ApiResponse<?> getAllProfessor(
@Parameter(example = "{\n"
+ " \"page\": 0,\n"
+ " \"size\": 10\n"
+ "}") Pageable pageable,
@Parameter(example = "서울") String campus,
@Parameter(example = "ICT융합대학") String college,
@Parameter(example = "응용소프트웨어전공") String major);

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.example.rentalSystem.global.response.example.ApiErrorCodeExample;
import com.example.rentalSystem.global.response.example.ApiErrorCodeExamples;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
Expand All @@ -28,6 +29,10 @@ ApiResponse<?> createRental(

@Operation(summary = "시설 대여 내역 전체 조회")
ApiResponse<Page<RentalHistoryResponseDto>> getAllRentalHistory(
@Parameter(example = "{\n"
+ " \"page\": 0,\n"
+ " \"size\": 10\n"
+ "}")
Pageable pageable);

@Operation(summary = "학생 시설 대여 내역 전체 조회")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,25 @@
import com.example.rentalSystem.domain.rentalhistory.entity.RentalApplicationResult;
import com.example.rentalSystem.domain.rentalhistory.entity.RentalHistory;
import com.example.rentalSystem.domain.student.entity.Student;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDateTime;
import lombok.Builder;

@Builder
public record CreateRentalRequest(
@Schema(example = "1")
String facilityId,
@Schema(description = "대여 시작 시간", example = "YYYY-MM-DDTHH:MM:SS")
LocalDateTime startTime,
@Schema(description = "대역 종료 시간", example = "YYYY-MM-DDTHH:MM:SS")
LocalDateTime endTime,
@Schema(description = "조직명", example = "COW")
String organization,
@Schema(description = "사용자 수", example = "4")
String numberOfPeople,
@Schema(description = "책임 교수 Id", example = "1")
String professorId,
@Schema(description = "사용 목적", example = "동아리 활동")
String purpose
) {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
package com.example.rentalSystem.domain.student.controller.dto.request;


public record StudentSignInRequest(String email, String password) {
import io.swagger.v3.oas.annotations.media.Schema;

public record StudentSignInRequest(
@Schema(example = "[email protected]")
String email,
@Schema(example = "test1234")
String password) {

}
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
package com.example.rentalSystem.domain.student.controller.dto.request;

import com.example.rentalSystem.domain.student.entity.Student;
import io.swagger.v3.oas.annotations.media.Schema;

public record StudentSignUpRequest(
@Schema(example = "아무개")
String name,
@Schema(example = "60200000")
String studentNumber,
@Schema(example = "test1234")
String password,
@Schema(example = "[email protected]")
String email,
@Schema(example = "응용소프트웨어전공")
String major,
@Schema(example = "010-0000-0000")
String phoneNumber) {

public Student toEntity(String encodePassword) {
Expand Down

0 comments on commit 4328420

Please sign in to comment.