Skip to content

Commit

Permalink
feat: create interface of photo apis (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
gmkim20713 committed Jun 15, 2024
1 parent f46c14d commit 8271765
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 0 deletions.
49 changes: 49 additions & 0 deletions photo-service/src/main/java/kr/mafoo/photo/api/PhotoApi.java
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
);
}
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
) {
}
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
) {
}
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
) {
}

0 comments on commit 8271765

Please sign in to comment.