Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.semosan.api.common.response.PageResponse;
import com.semosan.api.common.status.SuccessStatus;
import com.semosan.api.domain.semofeed.controller.docs.SemoFeedControllerDocs;
import com.semosan.api.domain.semofeed.dto.SemoFeedCreateRequest;
import com.semosan.api.domain.semofeed.dto.SemoFeedEmojiRequest;
import com.semosan.api.domain.semofeed.dto.SemoFeedEmojiToggleResponse;
import com.semosan.api.domain.semofeed.dto.SemoFeedResponse;
Expand All @@ -30,11 +31,12 @@ public class SemoFeedController implements SemoFeedControllerDocs {

@PostMapping
@Override
// @RequestBody String 대신 DTO를 사용해 Jackson이 JSON 따옴표를 제거한 뒤 imageUrl을 전달합니다.
public ResponseEntity<ApiResponse<SemoFeedResponse>> create(
@AuthenticationPrincipal Long userId,
@RequestBody String imageUrl
@Valid @RequestBody SemoFeedCreateRequest request
) {
SemoFeedResponse response = semoFeedService.create(userId, imageUrl);
SemoFeedResponse response = semoFeedService.create(userId, request.imageUrl());
return ApiResponse.success(SuccessStatus.SEMOFEED_CREATE_SUCCESS, response);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.semosan.api.common.response.ApiResponse;
import com.semosan.api.common.response.PageResponse;
import com.semosan.api.domain.semofeed.dto.SemoFeedCreateRequest;
import com.semosan.api.domain.semofeed.dto.SemoFeedEmojiRequest;
import com.semosan.api.domain.semofeed.dto.SemoFeedEmojiToggleResponse;
import com.semosan.api.domain.semofeed.dto.SemoFeedResponse;
Expand Down Expand Up @@ -42,7 +43,7 @@ public interface SemoFeedControllerDocs {
})
ResponseEntity<ApiResponse<SemoFeedResponse>> create(
@AuthenticationPrincipal Long userId,
@RequestBody String imageUrl
@RequestBody SemoFeedCreateRequest request
);

@Operation(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.semosan.api.domain.semofeed.dto;

import jakarta.validation.constraints.NotBlank;

/**
* 세모피드 생성 요청 DTO.
* {@code @RequestBody String} 대신 사용하여 Jackson이 JSON 문자열의 따옴표를 올바르게 제거하도록 한다.
*/
public record SemoFeedCreateRequest(
@NotBlank(message = "imageUrl 은 필수입니다.")
String imageUrl
) {
Comment thread
pooreumjung marked this conversation as resolved.
}