Skip to content

Commit 31d4944

Browse files
committed
feat/OPS-246 : api 요청 수정 - request 이름 통일
1 parent 6ada0a9 commit 31d4944

File tree

4 files changed

+12
-14
lines changed

4 files changed

+12
-14
lines changed

src/main/java/org/tuna/zoopzoop/backend/domain/datasource/controller/DataSourceController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,15 @@ public ResponseEntity<RsData<Void>> deleteMany(
8080
@PatchMapping("/soft-delete")
8181
public ResponseEntity<RsData<Void>> softDelete(@RequestBody @Valid IdsRequest rq,
8282
@AuthenticationPrincipal CustomUserDetails user) {
83-
personalApp.softDelete(user.getMember().getId(), rq.ids());
83+
personalApp.softDelete(user.getMember().getId(), rq.dataSourceId());
8484
return ResponseEntity.ok(new RsData<>("200", "자료들이 임시 삭제됐습니다.", null));
8585
}
8686

8787
@Operation(summary = "자료 다건 복원", description = "내 PersonalArchive 안에 자료들을 복원합니다.")
8888
@PatchMapping("/restore")
8989
public ResponseEntity<RsData<Void>> restore(@RequestBody @Valid IdsRequest rq,
9090
@AuthenticationPrincipal CustomUserDetails user) {
91-
personalApp.restore(user.getMember().getId(), rq.ids());
91+
personalApp.restore(user.getMember().getId(), rq.dataSourceId());
9292
return ResponseEntity.ok(new RsData<>("200", "자료들이 복구됐습니다.", null));
9393
}
9494

src/main/java/org/tuna/zoopzoop/backend/domain/datasource/dto/IdsRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77

88
public record IdsRequest (
99
@NotEmpty(message = "dataSourceId 배열은 비어있을 수 없습니다.")
10-
List<Integer> ids
10+
List<Integer> dataSourceId
1111
){}

src/main/java/org/tuna/zoopzoop/backend/domain/space/archive/controller/SpaceArchiveDataSourceController.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public ResponseEntity<RsData<Void>> softDelete(
6161
@RequestBody @Valid IdsRequest rq,
6262
@AuthenticationPrincipal CustomUserDetails user
6363
) {
64-
spaceApp.softDelete(user.getMember().getId(), spaceId, rq.ids());
64+
spaceApp.softDelete(user.getMember().getId(), spaceId, rq.dataSourceId());
6565
return ResponseEntity.ok(new RsData<>("200", "자료들이 임시 삭제됐습니다.", null));
6666
}
6767

@@ -72,7 +72,7 @@ public ResponseEntity<RsData<Void>> restore(
7272
@RequestBody @Valid IdsRequest rq,
7373
@AuthenticationPrincipal CustomUserDetails user
7474
) {
75-
spaceApp.restore(user.getMember().getId(), spaceId, rq.ids());
75+
spaceApp.restore(user.getMember().getId(), spaceId, rq.dataSourceId());
7676
return ResponseEntity.ok(new RsData<>("200", "자료들이 복구됐습니다.", null));
7777
}
7878

@@ -174,7 +174,7 @@ public ResponseEntity<RsData<Map<String, List<Integer>>>> importBatch(
174174
@AuthenticationPrincipal CustomUserDetails user
175175
) {
176176
@SuppressWarnings("unchecked")
177-
List<Integer> ids = (List<Integer>) body.get("datasourceId");
177+
List<Integer> ids = (List<Integer>) body.get("dataSourceId");
178178
Integer targetFolderId = (Integer) body.get("targetFolderId");
179179
List<Integer> results = spaceApp.importManyFromPersonal(
180180
user.getMember().getId(), spaceId, ids, targetFolderId);

src/test/java/org/tuna/zoopzoop/backend/domain/space/archive/controller/SpaceArchiveDataSourceControllerTest.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ void delete_many_ok() throws Exception {
202202
@WithUserDetails(value = "KAKAO:" + OWNER_PK, setupBefore = TestExecutionEvent.TEST_METHOD)
203203
@DisplayName("공유 자료 다건 임시 삭제")
204204
void soft_delete_ok() throws Exception {
205-
String body = om.writeValueAsString(Map.of("ids", List.of(ds1Id)));
205+
String body = om.writeValueAsString(Map.of("dataSourceId", List.of(ds1Id)));
206206
mockMvc.perform(patch("/api/v1/space/{spaceId}/archive/datasources/soft-delete", spaceId)
207207
.contentType(MediaType.APPLICATION_JSON)
208208
.content(body))
@@ -214,7 +214,7 @@ void soft_delete_ok() throws Exception {
214214
@WithUserDetails(value = "KAKAO:" + OWNER_PK, setupBefore = TestExecutionEvent.TEST_METHOD)
215215
@DisplayName("공유 자료 다건 복원")
216216
void restore_ok() throws Exception {
217-
String body = om.writeValueAsString(Map.of("ids", List.of(ds1Id)));
217+
String body = om.writeValueAsString(Map.of("dataSourceId", List.of(ds1Id)));
218218
mockMvc.perform(patch("/api/v1/space/{spaceId}/archive/datasources/restore", spaceId)
219219
.contentType(MediaType.APPLICATION_JSON)
220220
.content(body))
@@ -298,13 +298,11 @@ void update_ok() throws Exception {
298298
@WithUserDetails(value = "KAKAO:" + OWNER_PK, setupBefore = TestExecutionEvent.TEST_METHOD)
299299
@DisplayName("개인 → 공유: 단건 불러오기")
300300
void import_one_ok() throws Exception {
301-
// 개인 자료 id는 실제 테스트 환경에 맞게 심어둔 값으로 바꾸세요.
302-
// 여기서는 예시로 1 사용 (존재하지 않으면 404가 납니다)
303301
String body = om.writeValueAsString(Map.of(
304-
"datasourceId", personalDs1Id,
305-
"targetFolderId", defaultFolderId // 공유 아카이브의 대상 폴더 (0/null이면 default)
302+
"targetFolderId", defaultFolderId // 0/null이면 default
306303
));
307-
mockMvc.perform(post("/api/v1/space/{spaceId}/archive/datasources/import", spaceId)
304+
305+
mockMvc.perform(post("/api/v1/space/{spaceId}/archive/datasources/{dataSourceId}/import", spaceId, personalDs1Id)
308306
.contentType(MediaType.APPLICATION_JSON)
309307
.content(body))
310308
.andExpect(status().isOk())
@@ -316,7 +314,7 @@ void import_one_ok() throws Exception {
316314
@DisplayName("개인 → 공유: 다건 불러오기")
317315
void import_many_ok() throws Exception {
318316
String body = om.writeValueAsString(Map.of(
319-
"datasourceId", List.of(personalDs1Id, personalDs2Id, personalDs3Id),
317+
"dataSourceId", List.of(personalDs1Id, personalDs2Id, personalDs3Id),
320318
"targetFolderId", defaultFolderId
321319
));
322320
mockMvc.perform(post("/api/v1/space/{spaceId}/archive/datasources/import/batch", spaceId)

0 commit comments

Comments
 (0)