Skip to content

Commit

Permalink
날짜 json으로 변환 시 밀리세컨드 제거 및 이미지 multipart 이름 변경 (#309)
Browse files Browse the repository at this point in the history
  • Loading branch information
juno-junho authored Feb 1, 2024
1 parent e250874 commit 79142cd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/main/java/com/spaceclub/board/controller/PostController.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ public PostResponse getSingleClubBoardPost(

@PostMapping(value = "/{clubId}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public ResponseEntity<Void> createClubBoardPost(
@RequestPart(required = false) MultipartFile multipartFile,
@RequestPart(required = false) MultipartFile image,
@RequestPart PostRequest postRequest,
@PathVariable Long clubId,
@Authenticated JwtUser jwtUser) {
Long userId = jwtUser.id();

// 이미지가 존재할 경우
if (multipartFile != null) {
String postImageUrl = imageUploader.upload(multipartFile, S3Folder.POST_IMAGE);
if (image != null) {
String postImageUrl = imageUploader.upload(image, S3Folder.POST_IMAGE);
Long postId = postService.createClubBoardPost(clubId, postRequest, userId, postImageUrl);

return ResponseEntity
Expand All @@ -94,12 +94,12 @@ public ResponseEntity<Void> createClubBoardPost(

@PutMapping(value = "/{postId}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public void updateClubBoardPost(
@RequestPart(required = false) MultipartFile multipartFile,
@RequestPart(required = false) MultipartFile image,
@RequestPart PostUpdateRequest postRequest,
@PathVariable Long postId
) {
if (multipartFile != null) {
String postImageUrl = imageUploader.upload(multipartFile, S3Folder.POST_IMAGE);
if (image != null) {
String postImageUrl = imageUploader.upload(image, S3Folder.POST_IMAGE);
postService.updateClubBoardPost(postId, postRequest, postImageUrl);
return;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.spaceclub.board.controller.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.spaceclub.board.service.vo.CommentInfo;

import java.time.LocalDateTime;
Expand All @@ -10,7 +11,9 @@ public record CommentResponse(
Long authorId,
String author,
String authorImageUrl,
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
LocalDateTime createdDate,
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
LocalDateTime lastModifiedDate,
boolean isPrivate
) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.spaceclub.board.controller.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.spaceclub.board.service.vo.PostInfo;

import java.time.LocalDateTime;
Expand All @@ -12,7 +13,9 @@ public record PostResponse(
String author,
String authorImageUrl,
String postImageUrl,
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
LocalDateTime createdDate,
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
LocalDateTime lastModifiedDate
) {

Expand Down

0 comments on commit 79142cd

Please sign in to comment.