Skip to content

Commit

Permalink
✨ feat: create test api #15
Browse files Browse the repository at this point in the history
  • Loading branch information
noparamin committed Sep 28, 2023
1 parent bb0bb52 commit 27d6287
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/main/java/com/smart/watchboard/controller/GraphController.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.smart.watchboard.controller;

import com.smart.watchboard.common.support.AudioConcatenator;
import com.smart.watchboard.common.support.AwsS3Uploader;
import com.smart.watchboard.service.FileService;
import io.swagger.v3.oas.annotations.Operation;
Expand All @@ -12,22 +13,33 @@
import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile;

import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.UnsupportedAudioFileException;
import java.io.IOException;

@RestController
@RequestMapping("/graph")
@Tag(name = "그래프 API", description = "그래프 관련 API(mock)")
@RequiredArgsConstructor
@Slf4j
public class GraphController {

//private final RestTemplate restTemplate;

private final AwsS3Uploader awsS3Uploader;
private final AudioConcatenator audioConcatenator;
private final String aiServerUrl = "";

@PostMapping("/{documentID}")
@Operation(summary = "마인드맵 생성", description = "음성 데이터를 받아 ai 서버에 마인드맵 요청한다.")
public ResponseEntity<?> getMindmap(@PathVariable(value = "documentID") long documentId, @RequestParam("audioFile") MultipartFile audioFile, @RequestParam(value = "fileID", required = false) Long fileId, @RequestHeader("Authorization") String accessToken) {
awsS3Uploader.uploadImage(audioFile, documentId, fileId);
awsS3Uploader.uploadFile(audioFile, documentId, fileId);
//awsS3Uploader.deleteFile();

return new ResponseEntity<>("{\"root\":1,\"keywords\":[\"나는\",\"eat\",\"food\",\"today\"],\"graph\":{\"1\":[0,2],\"2\":[3]}}", HttpStatus.OK);
}

@PostMapping("/abc")
public ResponseEntity<?> test(@RequestParam("audioFile1") MultipartFile audioFile1, @RequestParam(value = "fileID", required = false) Long fileId) throws UnsupportedAudioFileException, IOException {
audioConcatenator.concatenateAudioFiles(audioFile1, fileId);
return new ResponseEntity<>("", HttpStatus.OK);
}
}

0 comments on commit 27d6287

Please sign in to comment.