-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create interface of photo apis (#3)
- Loading branch information
1 parent
f46c14d
commit 8271765
Showing
4 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
photo-service/src/main/java/kr/mafoo/photo/api/PhotoApi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package kr.mafoo.photo.api; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.Parameter; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import kr.mafoo.photo.controller.dto.request.PhotoCreateRequest; | ||
import kr.mafoo.photo.controller.dto.request.PhotoAlbumUpdateRequest; | ||
import kr.mafoo.photo.controller.dto.response.PhotoResponse; | ||
import org.springframework.web.bind.annotation.*; | ||
import reactor.core.publisher.Flux; | ||
import reactor.core.publisher.Mono; | ||
|
||
@Tag(name = "사진 관련 API", description = "사진 조회, 생성, 수정, 삭제 등 API") | ||
@RequestMapping("/v1/photos") | ||
public interface PhotoApi { | ||
@Operation(summary = "사진 조회", description = "사진 목록을 조회합니다.") | ||
@GetMapping | ||
Flux<PhotoResponse> getAlbumPhotos( | ||
@Parameter(description = "앨범 ID", example = "test_album_id") | ||
@RequestParam(required = false) | ||
String albumId | ||
); | ||
|
||
@Operation(summary = "사진 생성", description = "사진을 생성합니다.") | ||
@PostMapping("") | ||
Mono<PhotoResponse> createPhoto( | ||
@RequestBody | ||
PhotoCreateRequest request | ||
); | ||
|
||
@Operation(summary = "사진 앨범 수정", description = "사진을 다른 앨범으로 이동시킵니다.") | ||
@PatchMapping("/{photoId}/album") | ||
Mono<PhotoResponse> updatePhotoAlbum( | ||
@Parameter(description = "사진 ID", example = "test_photo_id") | ||
@PathVariable | ||
String photoId, | ||
|
||
@RequestBody | ||
PhotoAlbumUpdateRequest request | ||
); | ||
|
||
@Operation(summary = "사진 삭제", description = "사진을 삭제합니다.") | ||
@DeleteMapping("{photoId}") | ||
Mono<Void> deletePhoto( | ||
@Parameter(description = "사진 ID", example = "test_photo_id") | ||
@PathVariable | ||
String photoId | ||
); | ||
} |
10 changes: 10 additions & 0 deletions
10
...-service/src/main/java/kr/mafoo/photo/controller/dto/request/PhotoAlbumUpdateRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package kr.mafoo.photo.controller.dto.request; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
@Schema(description = "사진 앨범 수정 요청") | ||
public record PhotoAlbumUpdateRequest( | ||
@Schema(description = "앨범 ID", example = "test_album_id") | ||
String albumId | ||
) { | ||
} |
10 changes: 10 additions & 0 deletions
10
photo-service/src/main/java/kr/mafoo/photo/controller/dto/request/PhotoCreateRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package kr.mafoo.photo.controller.dto.request; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
@Schema(description = "사진 생성 요청") | ||
public record PhotoCreateRequest( | ||
@Schema(description = "QR URL", example = "qr_url") | ||
String qrUrl | ||
) { | ||
} |
16 changes: 16 additions & 0 deletions
16
photo-service/src/main/java/kr/mafoo/photo/controller/dto/response/PhotoResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package kr.mafoo.photo.controller.dto.response; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
@Schema(description = "사진 응답") | ||
public record PhotoResponse( | ||
@Schema(description = "사진 ID", example = "test_photo_id") | ||
String photoId, | ||
|
||
@Schema(description = "사진 URL", example = "photo_url") | ||
String photoUrl, | ||
|
||
@Schema(description = "앨범 ID", example = "test_album_id") | ||
String albumId | ||
) { | ||
} |