-
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 album apis (#3)
- Loading branch information
1 parent
20aade4
commit 58d0ea4
Showing
5 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
photo-service/src/main/java/kr/mafoo/photo/api/AlbumApi.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,46 @@ | ||
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.AlbumCreateRequest; | ||
import kr.mafoo.photo.controller.dto.request.AlbumUpdateRequest; | ||
import kr.mafoo.photo.controller.dto.response.AlbumResponse; | ||
import org.springframework.web.bind.annotation.*; | ||
import reactor.core.publisher.Flux; | ||
import reactor.core.publisher.Mono; | ||
|
||
@Tag(name = "์จ๋ฒ ๊ด๋ จ API", description = "์จ๋ฒ ์กฐํ, ์์ฑ, ์์ , ์ญ์ ๋ฑ API") | ||
@RequestMapping("/v1/albums") | ||
public interface AlbumApi { | ||
@Operation(summary = "์จ๋ฒ ์กฐํ", description = "์จ๋ฒ ๋ชฉ๋ก์ ์กฐํํฉ๋๋ค.") | ||
@GetMapping | ||
Flux<AlbumResponse> getAlbums( | ||
); | ||
|
||
@Operation(summary = "์จ๋ฒ ์์ฑ", description = "์จ๋ฒ์ ์์ฑํฉ๋๋ค.") | ||
@PostMapping("") | ||
Mono<AlbumResponse> createAlbum( | ||
@RequestBody | ||
AlbumCreateRequest request | ||
); | ||
|
||
@Operation(summary = "์จ๋ฒ ์์ ", description = "์จ๋ฒ์ ์ด๋ฆ ๋ฐ ์ข ๋ฅ๋ฅผ ์์ ํฉ๋๋ค.") | ||
@PutMapping("/{albumId}") | ||
Mono<AlbumResponse> updateAlbum( | ||
@Parameter(description = "์จ๋ฒ ID", example = "test_album_id") | ||
@PathVariable | ||
String albumId, | ||
|
||
@RequestBody | ||
AlbumUpdateRequest request | ||
); | ||
|
||
@Operation(summary = "์จ๋ฒ ์ญ์ ", description = "์จ๋ฒ์ ์ญ์ ํฉ๋๋ค.") | ||
@DeleteMapping("/{albumId}") | ||
Mono<Void> deleteAlbum( | ||
@Parameter(description = "์จ๋ฒ ID", example = "test_album_id") | ||
@PathVariable | ||
String albumId | ||
); | ||
} |
13 changes: 13 additions & 0 deletions
13
photo-service/src/main/java/kr/mafoo/photo/controller/dto/request/AlbumCreateRequest.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,13 @@ | ||
package kr.mafoo.photo.controller.dto.request; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
@Schema(description = "์จ๋ฒ ์์ฑ ์์ฒญ") | ||
public record AlbumCreateRequest( | ||
@Schema(description = "์จ๋ฒ ์ด๋ฆ", example = "์๊ธ์นํ์ทํ") | ||
String name, | ||
|
||
@Schema(description = "์จ๋ฒ ํ์ ", example = "TYPE_A") | ||
String type | ||
) { | ||
} |
13 changes: 13 additions & 0 deletions
13
photo-service/src/main/java/kr/mafoo/photo/controller/dto/request/AlbumUpdateRequest.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,13 @@ | ||
package kr.mafoo.photo.controller.dto.request; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
@Schema(description = "์จ๋ฒ ์์ ์์ฒญ") | ||
public record AlbumUpdateRequest( | ||
@Schema(description = "์จ๋ฒ ์ด๋ฆ", example = "์๊ธ์นํ์ทํ") | ||
String name, | ||
|
||
@Schema(description = "์จ๋ฒ ํ์ ", example = "TYPE_A") | ||
String type | ||
) { | ||
} |
20 changes: 20 additions & 0 deletions
20
photo-service/src/main/java/kr/mafoo/photo/controller/dto/response/AlbumResponse.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,20 @@ | ||
package kr.mafoo.photo.controller.dto.response; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import kr.mafoo.photo.domain.AlbumType; | ||
|
||
@Schema(description = "์จ๋ฒ ์๋ต") | ||
public record AlbumResponse( | ||
@Schema(description = "์จ๋ฒ ID", example = "test_album_id") | ||
String albumId, | ||
|
||
@Schema(description = "์จ๋ฒ ์ด๋ฆ", example = "์ผ๋ฟ๋ค") | ||
String name, | ||
|
||
@Schema(description = "์จ๋ฒ ์ข ๋ฅ", example = "TYPE_B") | ||
AlbumType type, | ||
|
||
@Schema(description = "์จ๋ฒ ๋ด ์ฌ์ง ์", example = "6") | ||
String photoCount | ||
) { | ||
} |
10 changes: 10 additions & 0 deletions
10
photo-service/src/main/java/kr/mafoo/photo/domain/AlbumType.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.domain; | ||
|
||
public enum AlbumType { | ||
TYPE_A, | ||
TYPE_B, | ||
TYPE_C, | ||
TYPE_D, | ||
TYPE_E, | ||
TYPE_F, | ||
} |