Skip to content

Commit

Permalink
objectMapper time module 설정 (#296)
Browse files Browse the repository at this point in the history
  • Loading branch information
Juhongseok authored Nov 27, 2023
1 parent 82f52e4 commit 7149939
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import lombok.RequiredArgsConstructor;
import org.devcourse.resumeme.business.comment.domain.Comment;
import org.devcourse.resumeme.business.comment.repository.CommentRepository;
Expand Down Expand Up @@ -38,6 +39,8 @@ public Comment create(Comment comment, Long resumeId) {
RestTemplate restTemplate = new RestTemplate();
Map<String, List<ComponentResponse>> response = restTemplate.getForObject(new URI("http://localhost:8080/api/v1/resumes/" + resumeId), Map.class);
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.registerModule(new JavaTimeModule());

String json = objectMapper.writeValueAsString(response);

snapshotRepository.save(new Snapshot(json, null, resumeId));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import lombok.RequiredArgsConstructor;
import org.devcourse.resumeme.business.comment.controller.dto.CommentWithReviewResponse;
import org.devcourse.resumeme.business.resume.entity.Snapshot;
Expand Down Expand Up @@ -29,6 +30,8 @@ public void onApplicationEvent(CommentSnapEvent event) {
RestTemplate restTemplate = new RestTemplate();
CommentWithReviewResponse response = restTemplate.getForObject(new URI("http://localhost:8080/api/v1/events/" + eventId + "/resumes/" + resumeId + "/comments"), CommentWithReviewResponse.class);
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.registerModule(new JavaTimeModule());

String commentData = objectMapper.writeValueAsString(response);
Optional<Snapshot> snapshotOption = snapshotRepository.findByResumeId(resumeId);
if (snapshotOption.isPresent()) {
Expand Down

0 comments on commit 7149939

Please sign in to comment.