Skip to content

Commit

Permalink
♻️ Refactor : isSuccess 제거 (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
oxdjww authored Jan 16, 2024
1 parent 1f7a38e commit d911c7a
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/main/java/com/sponus/sponusbe/global/common/ApiResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,9 @@

@Getter
@AllArgsConstructor
@JsonPropertyOrder({"isSuccess", "statusCode", "message", "content"})
@JsonPropertyOrder({"statusCode", "message", "content"})
public class ApiResponse<T> {

@JsonProperty("isSuccess")
@NonNull
private final Boolean isSuccess;

@JsonProperty("statusCode")
@NonNull
private final String statusCode;
Expand All @@ -35,16 +31,16 @@ public class ApiResponse<T> {

// 성공한 경우 응답 생성
public static <T> ApiResponse<T> onSuccess(T content) {
return new ApiResponse<>(true, HttpStatus.OK.name(), HttpStatus.OK.getReasonPhrase(), content);
return new ApiResponse<>(HttpStatus.OK.name(), HttpStatus.OK.getReasonPhrase(), content);
}

// 실패한 경우 응답 생성
public static <T> ApiResponse<T> onFailure(String statusCode, String message) {
return new ApiResponse<>(false, statusCode, message, null);
return new ApiResponse<>(statusCode, message, null);
}

public static <T> ApiResponse<T> onFailure(String statusCode, String message, T content) {
return new ApiResponse<>(false, statusCode, message, content);
return new ApiResponse<>(statusCode, message, content);
}

// Json serialize
Expand Down

0 comments on commit d911c7a

Please sign in to comment.