Skip to content

Commit 6ada0a9

Browse files
committed
feat/OPS-246 : api 요청 수정
1 parent 4d09007 commit 6ada0a9

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

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

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -151,16 +151,15 @@ public ResponseEntity<RsData<Map<String, Integer>>> update(
151151

152152

153153
@Operation(summary = "개인 → 공유: 자료 단건 불러오기")
154-
@PostMapping("/import")
154+
@PostMapping("/{dataSourceId}/import")
155155
public ResponseEntity<RsData<Map<String, Integer>>> importOne(
156156
@PathVariable String spaceId,
157+
@PathVariable Integer dataSourceId,
157158
@RequestBody Map<String, Object> body,
158159
@AuthenticationPrincipal CustomUserDetails user
159160
) {
160-
Integer personalDataSourceId = (Integer) body.get("datasourceId");
161-
Integer targetFolderId = (Integer) body.get("targetFolderId"); // 0 또는 null이면 default
162-
163-
int createdId = spaceApp.importFromPersonal(user.getMember().getId(), spaceId, personalDataSourceId, targetFolderId);
161+
Integer targetFolderId = (body == null) ? null : (Integer) body.get("targetFolderId"); // 0/null = default 처리 내부에서
162+
int createdId = spaceApp.importFromPersonal(user.getMember().getId(), spaceId, dataSourceId, targetFolderId);
164163

165164
return ResponseEntity.ok(
166165
new RsData<>("200", createdId + "번 자료를 불러오기에 성공하였습니다.", Map.of("dataSourceId", createdId))
@@ -176,12 +175,12 @@ public ResponseEntity<RsData<Map<String, List<Integer>>>> importBatch(
176175
) {
177176
@SuppressWarnings("unchecked")
178177
List<Integer> ids = (List<Integer>) body.get("datasourceId");
179-
Integer targetFolderId = (Integer) body.get("targetFolderId"); // 0 또는 null이면 default
180-
181-
List<Integer> results = spaceApp.importManyFromPersonal(user.getMember().getId(), spaceId, ids, targetFolderId);
182-
178+
Integer targetFolderId = (Integer) body.get("targetFolderId");
179+
List<Integer> results = spaceApp.importManyFromPersonal(
180+
user.getMember().getId(), spaceId, ids, targetFolderId);
183181
return ResponseEntity.ok(
184-
new RsData<>("200", results.size() + "건의 자료 불러오기에 성공하였습니다.", Map.of("results", results))
182+
new RsData<>("200", results.size() + "건의 자료 불러오기에 성공하였습니다.",
183+
Map.of("results", results))
185184
);
186185
}
187186

0 commit comments

Comments
 (0)