|
3 | 3 | import jakarta.validation.Valid; |
4 | 4 | import kr.kro.photoliner.domain.album.dto.request.AlbumCreateRequest; |
5 | 5 | import kr.kro.photoliner.domain.album.dto.request.AlbumDeleteRequest; |
| 6 | +import kr.kro.photoliner.domain.album.dto.request.AlbumItemCreateRequest; |
| 7 | +import kr.kro.photoliner.domain.album.dto.request.AlbumItemDeleteRequest; |
| 8 | +import kr.kro.photoliner.domain.album.dto.request.AlbumTitleUpdateRequest; |
6 | 9 | import kr.kro.photoliner.domain.album.dto.response.AlbumCreateResponse; |
| 10 | +import kr.kro.photoliner.domain.album.dto.response.AlbumPhotoItemsResponse; |
7 | 11 | import kr.kro.photoliner.domain.album.dto.response.AlbumsResponse; |
8 | 12 | import kr.kro.photoliner.domain.album.service.AlbumService; |
9 | 13 | import lombok.RequiredArgsConstructor; |
|
14 | 18 | import org.springframework.http.ResponseEntity; |
15 | 19 | import org.springframework.web.bind.annotation.DeleteMapping; |
16 | 20 | import org.springframework.web.bind.annotation.GetMapping; |
| 21 | +import org.springframework.web.bind.annotation.PatchMapping; |
| 22 | +import org.springframework.web.bind.annotation.PathVariable; |
17 | 23 | import org.springframework.web.bind.annotation.PostMapping; |
18 | 24 | import org.springframework.web.bind.annotation.RequestBody; |
19 | 25 | import org.springframework.web.bind.annotation.RequestMapping; |
@@ -43,11 +49,46 @@ public ResponseEntity<AlbumsResponse> getAlbums( |
43 | 49 | return ResponseEntity.ok(albumService.getAlbums(userId, pageable)); |
44 | 50 | } |
45 | 51 |
|
| 52 | + @PatchMapping("/{albumId}/title") |
| 53 | + public ResponseEntity<Void> updateAlbumTitle( |
| 54 | + @PathVariable Long albumId, |
| 55 | + @RequestBody @Valid AlbumTitleUpdateRequest request |
| 56 | + ) { |
| 57 | + albumService.updateAlbumTitle(albumId, request); |
| 58 | + return ResponseEntity.noContent().build(); |
| 59 | + } |
| 60 | + |
46 | 61 | @DeleteMapping |
47 | 62 | public ResponseEntity<Void> deletePhoto( |
48 | 63 | @Valid @RequestBody AlbumDeleteRequest request |
49 | 64 | ) { |
50 | 65 | albumService.deleteAlbums(request); |
51 | 66 | return ResponseEntity.noContent().build(); |
52 | 67 | } |
| 68 | + |
| 69 | + @GetMapping("/{albumId}/photos") |
| 70 | + public ResponseEntity<AlbumPhotoItemsResponse> getAlbumItems( |
| 71 | + @PathVariable Long albumId, |
| 72 | + @PageableDefault(sort = "capturedDt", direction = Sort.Direction.DESC) Pageable pageable |
| 73 | + ) { |
| 74 | + return ResponseEntity.ok(albumService.getAlbumPhotoItems(albumId, pageable)); |
| 75 | + } |
| 76 | + |
| 77 | + @PostMapping("/{albumId}/photos") |
| 78 | + public ResponseEntity<Void> createAlbumItems( |
| 79 | + @PathVariable Long albumId, |
| 80 | + @RequestBody @Valid AlbumItemCreateRequest request |
| 81 | + ) { |
| 82 | + albumService.createAlbumItems(albumId, request); |
| 83 | + return ResponseEntity.noContent().build(); |
| 84 | + } |
| 85 | + |
| 86 | + @DeleteMapping("/{albumId}/photos") |
| 87 | + public ResponseEntity<Void> deleteAlbumItems( |
| 88 | + @PathVariable Long albumId, |
| 89 | + @RequestBody @Valid AlbumItemDeleteRequest request |
| 90 | + ) { |
| 91 | + albumService.deleteAlbumItems(albumId, request); |
| 92 | + return ResponseEntity.noContent().build(); |
| 93 | + } |
53 | 94 | } |
0 commit comments