Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
practise30 committed Aug 21, 2024
1 parent c406ddf commit 5baf92b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.awt.*;
import java.util.List;

@RestController
@RequiredArgsConstructor
Expand All @@ -17,7 +18,7 @@ public class TestBulletinController {
private final TestBulletinService service;

@PostMapping("/test")
public void test(@RequestPart(required = false) BulletinTestDto dto) {
service.uploadTestBulletin(dto);
public void test(@RequestPart(name = "dto", required = false)List<MultipartFile> files) {
service.uploadTestBulletin(files);
}
}
10 changes: 6 additions & 4 deletions src/main/java/nbdream/bulletin/service/TestBulletinService.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
import nbdream.image.service.ImageService;
import nbdream.image.service.TestImageService;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

@Service
@RequiredArgsConstructor
Expand All @@ -16,10 +19,9 @@ public class TestBulletinService {
private final BulletinRepository repository;
private final ImageService imageService;

public void uploadTestBulletin(BulletinTestDto dto) {
repository.saveContent(dto.getContent());
for (int i = 0; i < dto.getFiles().size(); i++) {
testImageService.uploadTestImage(dto.getFiles().get(i));
public void uploadTestBulletin(List<MultipartFile> files) {
for (int i = 0; i < files.size(); i++) {
testImageService.uploadTestImage(files.get(i));

}
}
Expand Down

0 comments on commit 5baf92b

Please sign in to comment.