-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git commit -m "feat/#13 program List 반환 api 개발"
- Loading branch information
Showing
8 changed files
with
78 additions
and
7 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
src/main/java/org/sopt/sopkerton/common/exception/ProgramError.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package org.sopt.sopkerton.common.exception; | ||
|
||
public enum ProgramError { | ||
} |
29 changes: 29 additions & 0 deletions
29
src/main/java/org/sopt/sopkerton/common/exception/ProgramSuccess.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package org.sopt.sopkerton.common.exception; | ||
|
||
import lombok.AllArgsConstructor; | ||
import org.sopt.sopkerton.common.exception.base.SuccessBase; | ||
import org.springframework.http.HttpStatus; | ||
|
||
@AllArgsConstructor | ||
public enum ProgramSuccess implements SuccessBase { | ||
PROGRAM_LIST_VIEW_SUCCESS(HttpStatus.OK, "Get Program List View Data Successful.") | ||
; | ||
|
||
private final HttpStatus status; | ||
private final String successMessage; | ||
|
||
@Override | ||
public int getHttpStatusCode() { | ||
return this.status.value(); | ||
} | ||
|
||
@Override | ||
public HttpStatus getHttpStatus() { | ||
return this.status; | ||
} | ||
|
||
@Override | ||
public String getSuccessMessage() { | ||
return this.successMessage; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/main/java/org/sopt/sopkerton/program/controller/ProgramController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.sopt.sopkerton.program.controller; | ||
|
||
import java.util.List; | ||
import lombok.RequiredArgsConstructor; | ||
import org.sopt.sopkerton.common.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; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/v1/program") | ||
public class ProgramController { | ||
private final ProgramService programService; | ||
|
||
@GetMapping("") | ||
public ResponseEntity<ApiResponse<List<ProgramListResponse>>> programListView(@RequestParam(name = "program_type") String type) { | ||
List<ProgramListResponse> programListByProgramType = programService.getProgramListByProgramType(type); | ||
return ResponseEntity | ||
.status(ProgramSuccess.PROGRAM_LIST_VIEW_SUCCESS.getHttpStatus()) | ||
.body( | ||
ApiResponse.success(ProgramSuccess.PROGRAM_LIST_VIEW_SUCCESS, programListByProgramType) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters