Skip to content

Commit

Permalink
feat: add voice comment apis
Browse files Browse the repository at this point in the history
  • Loading branch information
CChuYong committed Nov 30, 2024
1 parent e097272 commit bcb3517
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.oing.dto.response;

import io.swagger.v3.oas.annotations.media.Schema;
import java.time.ZonedDateTime;

@Schema(description = "피드 게시물 음성 댓글 응답")
public record PostVoiceCommentResponse(
@Schema(description = "피드 게시물 댓글 ID", example = "01HGW2N7EHJVJ4CJ999RRS2E97")
String commentId,

@Schema(description = "피드 게시물 ID", example = "01HGW2N7EHJVJ4CJ999RRS2E97")
String postId,

@Schema(description = "음성 댓글 작성 사용자 ID", example = "01HGW2N7EHJVJ4CJ999RRS2E97")
String memberId,

@Schema(description = "음성 댓글 오디오 URL", example = "https://..")
String audioUrl,

@Schema(description = "댓글 작성 시간", example = "2023-12-23T01:53:21.577347+09:00")
ZonedDateTime createdAt
) {

}
77 changes: 77 additions & 0 deletions post/src/main/java/com/oing/restapi/VoiceCommentApi.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package com.oing.restapi;

import com.oing.dto.request.CreatePostCommentRequest;
import com.oing.dto.response.DefaultResponse;
import com.oing.dto.response.PaginationResponse;
import com.oing.dto.response.PostVoiceCommentResponse;
import com.oing.util.security.LoginMemberId;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import jakarta.validation.constraints.Min;
import org.springframework.web.bind.annotation.*;

@Tag(name = "게시물 음성 댓글 API", description = "게시물 음성 댓글 관련 API")
@RestController
@Valid
@RequestMapping("/v1/posts/{postId}/voice-comments")
public interface VoiceCommentApi {
@Operation(summary = "게시물 음성 댓글 추가", description = "게시물에 음성 댓글을 추가합니다.")
@PostMapping
PostVoiceCommentResponse createPostVoiceComment(
@Parameter(description = "게시물 ID", example = "01HGW2N7EHJVJ4CJ999RRS2E97")
@PathVariable
String postId,

@Valid
@RequestBody
CreatePostCommentRequest request,

@Parameter(hidden = true)
@LoginMemberId
String loginMemberId
);

@Operation(summary = "게시물 음성 댓글 삭제", description = "게시물에 음성 댓글을 삭제합니다.")
@DeleteMapping("/{commentId}")
DefaultResponse deletePostVoiceComment(
@Parameter(description = "게시물 ID", example = "01HGW2N7EHJVJ4CJ999RRS2E97")
@PathVariable
String postId,

@Parameter(description = "음성 댓글 ID", example = "01HGW2N7EHJVJ4CJ999RRS2E97")
@PathVariable
String commentId,

@Parameter(hidden = true)
@LoginMemberId
String loginMemberId
);

@Operation(summary = "게시물 음성 댓글 조회", description = "게시물에 달린 음성 댓글을 조회합니다.")
@GetMapping
PaginationResponse<PostVoiceCommentResponse> getPostComments(
@Parameter(description = "게시물 ID", example = "01HGW2N7EHJVJ4CJ999RRS2E97")
@PathVariable
String postId,

@RequestParam(required = false, defaultValue = "1")
@Parameter(description = "가져올 현재 페이지", example = "1")
@Min(value = 1)
Integer page,

@RequestParam(required = false, defaultValue = "10")
@Parameter(description = "가져올 페이지당 크기", example = "10")
@Min(value = 1)
Integer size,

@RequestParam(required = false)
@Parameter(description = "정렬 방식", example = "DESC | ASC")
String sort,

@Parameter(hidden = true)
@LoginMemberId
String loginMemberId
);
}

0 comments on commit bcb3517

Please sign in to comment.