Skip to content

Commit 555652a

Browse files
authored
[FEAT] 공통 응답 수정
[FEAT] 공통 응답 수정
2 parents 3f3b72b + 8524ef6 commit 555652a

File tree

2 files changed

+9
-26
lines changed

2 files changed

+9
-26
lines changed

src/main/java/team/wego/wegobackend/common/response/ApiResponse.java

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,27 @@
44

55
@JsonInclude(JsonInclude.Include.NON_NULL)
66
public record ApiResponse<T>(
7-
String code,
87
String message,
98
T data
109
) {
1110

1211
public static <T> ApiResponse<T> success(T data) {
13-
return new ApiResponse<>("200", "요청이 정상적으로 처리되었습니다.", data);
12+
return new ApiResponse<>( "요청이 정상적으로 처리되었습니다.", data);
1413
}
1514

16-
public static <T> ApiResponse<T> success(String code, String message, T data) {
17-
return new ApiResponse<>(code, message, data);
15+
public static <T> ApiResponse<T> success(String message, T data) {
16+
return new ApiResponse<>(message, data);
1817
}
1918

20-
public static <T> ApiResponse<T> success(String code, String message) {
21-
return new ApiResponse<>(code, message, null);
19+
public static <T> ApiResponse<T> success( String message) {
20+
return new ApiResponse<>( message, null);
2221
}
2322

24-
public static <T> ApiResponse<T> success(int code, String message, T data) {
25-
return new ApiResponse<>(String.valueOf(code), message, data);
23+
public static <T> ApiResponse<T> error( String message) {
24+
return new ApiResponse<>(message, null);
2625
}
2726

28-
public static <T> ApiResponse<T> success(int code, String message) {
29-
return new ApiResponse<>(String.valueOf(code), message, null);
30-
}
31-
32-
33-
public static <T> ApiResponse<T> error(String code, String message) {
34-
return new ApiResponse<>(code, message, null);
35-
}
36-
37-
public static <T> ApiResponse<T> error(String code, String message, T data) {
38-
return new ApiResponse<>(code, message, data);
27+
public static <T> ApiResponse<T> error(String message, T data) {
28+
return new ApiResponse<>(message, data);
3929
}
4030
}

src/main/java/team/wego/wegobackend/image/presentation/ImageController.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ public ResponseEntity<ApiResponse<ImageFileResponse>> uploadOriginal(
3838
return ResponseEntity
3939
.status(HttpStatus.CREATED)
4040
.body(ApiResponse.success(
41-
HttpStatus.CREATED.value(),
4241
"이미지: 원본 업로드가 정상적으로 처리되었습니다.",
4342
response
4443
));
@@ -60,7 +59,6 @@ public ResponseEntity<ApiResponse<List<ImageFileResponse>>> uploadOriginals(
6059
return ResponseEntity
6160
.status(HttpStatus.CREATED)
6261
.body(ApiResponse.success(
63-
HttpStatus.CREATED.value(),
6462
"이미지: 여러 원본 업로드가 정상적으로 처리되었습니다.",
6563
responses
6664
));
@@ -80,7 +78,6 @@ public ResponseEntity<ApiResponse<ImageFileResponse>> uploadAsWebp(
8078
return ResponseEntity
8179
.status(HttpStatus.CREATED)
8280
.body(ApiResponse.success(
83-
HttpStatus.CREATED.value(),
8481
"이미지: WebP 변환 업로드가 정상적으로 처리되었습니다.",
8582
response
8683
));
@@ -102,7 +99,6 @@ public ResponseEntity<ApiResponse<List<ImageFileResponse>>> uploadAllAsWebp(
10299
return ResponseEntity
103100
.status(HttpStatus.CREATED)
104101
.body(ApiResponse.success(
105-
HttpStatus.CREATED.value(),
106102
"이미지: 여러 WebP 변환 업로드가 정상적으로 처리되었습니다.",
107103
responses
108104
));
@@ -114,7 +110,6 @@ public ResponseEntity<ApiResponse<Void>> deleteOne(@RequestParam("key") String k
114110

115111
return ResponseEntity
116112
.ok(ApiResponse.success(
117-
HttpStatus.CREATED.toString(),
118113
"이미지: 단일 삭제가 정상적으로 처리되었습니다."
119114
));
120115
}
@@ -125,7 +120,6 @@ public ResponseEntity<ApiResponse<Void>> deleteMany(@RequestParam("keys") List<S
125120

126121
return ResponseEntity
127122
.ok(ApiResponse.success(
128-
HttpStatus.OK.value(),
129123
"이미지: 여러 건 삭제가 정상적으로 처리되었습니다."
130124
));
131125
}
@@ -144,7 +138,6 @@ public ResponseEntity<ApiResponse<ImageFileResponse>> uploadThumb(
144138
return ResponseEntity
145139
.status(HttpStatus.CREATED)
146140
.body(ApiResponse.success(
147-
HttpStatus.CREATED.value(),
148141
"이미지: 썸네일 업로드가 정상적으로 처리되었습니다.",
149142
response
150143
));

0 commit comments

Comments
 (0)