From 36aadd50ad6b1845c1dc39ac348c2ca83d7e830a Mon Sep 17 00:00:00 2001 From: yummygyudon Date: Sun, 26 Nov 2023 05:36:13 +0900 Subject: [PATCH] =?UTF-8?q?FEAT=20:=20Program=20=EC=83=81=EC=84=B8=20?= =?UTF-8?q?=EB=B7=B0=20=EC=A1=B0=ED=9A=8C=20API=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../program/controller/ProgramController.java | 16 ++++++-- .../dto/response/ProgramDetailResponse.java | 38 +++++++++++++++++++ 2 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 src/main/java/org/sopt/sopkerton/program/dto/response/ProgramDetailResponse.java diff --git a/src/main/java/org/sopt/sopkerton/program/controller/ProgramController.java b/src/main/java/org/sopt/sopkerton/program/controller/ProgramController.java index 449c87f..5ab3b87 100644 --- a/src/main/java/org/sopt/sopkerton/program/controller/ProgramController.java +++ b/src/main/java/org/sopt/sopkerton/program/controller/ProgramController.java @@ -2,14 +2,12 @@ import java.util.List; import lombok.RequiredArgsConstructor; -import org.sopt.sopkerton.common.exception.ProgramSuccess; +import org.sopt.sopkerton.program.domain.exception.ProgramSuccess; import org.sopt.sopkerton.common.response.ApiResponse; -import org.sopt.sopkerton.program.dto.request.ProgramListRequest; import org.sopt.sopkerton.program.dto.response.ProgramListResponse; import org.sopt.sopkerton.program.service.ProgramService; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @@ -29,4 +27,16 @@ public ResponseEntity>> programListView(@R ApiResponse.success(ProgramSuccess.PROGRAM_LIST_VIEW_SUCCESS, programListByProgramType) ); } + + @GetMapping("/detail") + public ResponseEntity orderProgramDetail( + @RequestParam("programId") Long programId + ) { + Object programDetail = programService.getProgramDetail(1L, programId); + return ResponseEntity + .status(ProgramSuccess.PROGRAM_DETAIL_VIEW_SUCCESS.getHttpStatus()) + .body( + ApiResponse.success(ProgramSuccess.PROGRAM_DETAIL_VIEW_SUCCESS, programDetail) + ); + } } diff --git a/src/main/java/org/sopt/sopkerton/program/dto/response/ProgramDetailResponse.java b/src/main/java/org/sopt/sopkerton/program/dto/response/ProgramDetailResponse.java new file mode 100644 index 0000000..d4bdf3f --- /dev/null +++ b/src/main/java/org/sopt/sopkerton/program/dto/response/ProgramDetailResponse.java @@ -0,0 +1,38 @@ +package org.sopt.sopkerton.program.dto.response; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public abstract class ProgramDetailResponse { + + public record VolunteerDetail( + @JsonProperty("imageUrl") + String imageUrl, + @JsonProperty("content") + String content, + @JsonProperty("organizationName") + String organizationName, + @JsonProperty("registerAt") + String registerAt, + @JsonProperty("hour") + int hour, + @JsonProperty("isApply") + boolean isApply + ) { + } + + public record EmploymentDetail( + @JsonProperty("imageUrl") + String imageUrl, + @JsonProperty("content") + String content, + @JsonProperty("organizationName") + String organizationName, + @JsonProperty("registerAt") + String registerAt, + @JsonProperty("salary") + int salary, + @JsonProperty("isApply") + boolean isApply + ) { + } +}