Skip to content

Commit

Permalink
feat: create interface of album apis (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
gmkim20713 committed Jun 15, 2024
1 parent 20aade4 commit 58d0ea4
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 0 deletions.
46 changes: 46 additions & 0 deletions photo-service/src/main/java/kr/mafoo/photo/api/AlbumApi.java
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
);
}
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
) {
}
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
) {
}
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 photo-service/src/main/java/kr/mafoo/photo/domain/AlbumType.java
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,
}

0 comments on commit 58d0ea4

Please sign in to comment.