Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #104 from Strong-Potato/bugfix/#103-add-generics-i…
Browse files Browse the repository at this point in the history
…n-apiresponse

[Bugfix] ApiResponse에 제네릭을 추가한다.
  • Loading branch information
Dr-KoKo authored Jan 16, 2024
2 parents a0c62d5 + 1f7fee1 commit bebcc8d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public ApiResponse<ReviewCreateResponse> createReview(@Valid @RequestBody Review
}

@PatchMapping
public ApiResponse<ReviewCreateResponse> editReview(@Valid @RequestBody ReviewEditRequest reviewEditRequest) {
public ApiResponse<ReviewEditResponse> editReview(@Valid @RequestBody ReviewEditRequest reviewEditRequest) {
return ApiResponse.ok(reviewService.editReview(reviewEditRequest));
}

Expand Down
16 changes: 8 additions & 8 deletions app/src/main/java/fc/be/app/global/http/ApiResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ public record ApiResponse<T>(
private static final HttpStatus CREATED = HttpStatus.CREATED;
private static final String DEFAULT_MESSAGE = "SUCCESS";

public static ApiResponse ok() {
return new ApiResponse(OK.value(), DEFAULT_MESSAGE, null);
public static ApiResponse<Void> ok() {
return new ApiResponse<>(OK.value(), DEFAULT_MESSAGE, null);
}

public static <T> ApiResponse ok(T data) {
return new ApiResponse(OK.value(), DEFAULT_MESSAGE, data);
public static <T> ApiResponse<T> ok(T data) {
return new ApiResponse<>(OK.value(), DEFAULT_MESSAGE, data);
}

public static ApiResponse created() {
return new ApiResponse(CREATED.value(), DEFAULT_MESSAGE, null);
public static ApiResponse<Void> created() {
return new ApiResponse<>(CREATED.value(), DEFAULT_MESSAGE, null);
}

public static <T> ApiResponse created(T data) {
return new ApiResponse(CREATED.value(), DEFAULT_MESSAGE, data);
public static <T> ApiResponse<T> created(T data) {
return new ApiResponse<>(CREATED.value(), DEFAULT_MESSAGE, data);
}
}

0 comments on commit bebcc8d

Please sign in to comment.