Skip to content

Commit 88ca6f2

Browse files
committed
feat : memory album test api
1 parent 4e97efc commit 88ca6f2

2 files changed

Lines changed: 10 additions & 17 deletions

File tree

src/main/java/com/example/startlight/memoryAlbum/controller/MemoryAlbumController.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.fasterxml.jackson.core.JsonProcessingException;
88
import com.fasterxml.jackson.databind.ObjectMapper;
99
import lombok.RequiredArgsConstructor;
10+
import org.springframework.data.web.PageableDefault;
1011
import org.springframework.http.HttpStatus;
1112
import org.springframework.http.ResponseEntity;
1213
import org.springframework.web.bind.annotation.*;
@@ -21,9 +22,9 @@ public class MemoryAlbumController {
2122
private final MemoryAlbumScheduleService memoryAlbumScheduleService;
2223
private final MemoryAlbumService memoryAlbumService;
2324

24-
@GetMapping()
25-
public ResponseEntity<?> createMemoryAlbum() {
26-
memoryAlbumFlaskService.generateMemoryAlbum(52L,0);
25+
@GetMapping("/album/{petId}")
26+
public ResponseEntity<?> createMemoryAlbum(@PathVariable Long petId) {
27+
memoryAlbumFlaskService.generateMemoryAlbum(petId,0);
2728
return ResponseEntity.ok().build();
2829
}
2930

@@ -87,15 +88,15 @@ public ResponseEntity<MemoryAlbumRepDto> addMemoryAlbum() {
8788
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
8889
}
8990

90-
@GetMapping("/random")
91-
public ResponseEntity<?> getRandomMemoryAlbum() {
92-
memoryAlbumFlaskService.generateMemoryAlbum(102L,3);
91+
@GetMapping("/random/{petId}")
92+
public ResponseEntity<?> getRandomMemoryAlbum(@PathVariable Long petId) {
93+
memoryAlbumFlaskService.generateMemoryAlbum(petId,3);
9394
return ResponseEntity.ok().build();
9495
}
9596

9697
@GetMapping("/birth")
97-
public ResponseEntity<?> getBirthMemoryAlbum() {
98-
memoryAlbumFlaskService.generateMemoryAlbum(102L,1);
98+
public ResponseEntity<?> getBirthMemoryAlbum(@PathVariable Long petId) {
99+
memoryAlbumFlaskService.generateMemoryAlbum(petId,1);
99100
return ResponseEntity.ok().build();
100101
}
101102
}

src/main/java/com/example/startlight/memoryAlbum/service/MemoryAlbumFlaskService.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,7 @@ public void generateMemoryAlbum(Long petId, Integer num) {
5252
trainingPetId = petId;
5353
trainingNum = num;
5454

55-
List<String> images = List.of(
56-
"https://starlightbucket.s3.amazonaws.com/ml_test/kkong1.jpg",
57-
"https://starlightbucket.s3.amazonaws.com/ml_test/kkong2.jpg",
58-
"https://starlightbucket.s3.amazonaws.com/ml_test/kkong3.jpg",
59-
"https://starlightbucket.s3.amazonaws.com/ml_test/kkong4.jpg",
60-
"https://starlightbucket.s3.amazonaws.com/ml_test/kkong5.jpg"
61-
);
62-
63-
//List<String> images = memoryAlbumDao.getRecent5ImgsByPetId(petId);
55+
List<String> images = memoryAlbumDao.getRecent5ImgsByPetId(petId);
6456
System.out.println(images);
6557

6658
Map<String, Object> requestBody = Map.of("images", images);

0 commit comments

Comments
 (0)