Update the Post Object for use to get called

This commit is contained in:
YuCheng Hu 2023-10-02 01:36:04 -04:00
parent e74da4ed8a
commit 87e4e5e2f4
2 changed files with 8 additions and 6 deletions

View File

@ -2,6 +2,7 @@ package com.ossez.discourse.client.service;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.ossez.discourse.client.DiscourseClient;
import com.ossez.discourse.common.model.dto.Post;
import com.ossez.discourse.common.model.dto.Topics;
@ -48,6 +49,7 @@ public class PostsService extends DiscourseClient {
if (response.code() == HttpStatus.SC_OK) {
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
objectMapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);
post = Optional.of(objectMapper.readValue(responseStr, Post.class));
}
} catch (IOException e) {

View File

@ -11,8 +11,8 @@ public class Post {
private String avatarTemplate;
private String createdAt;
private String cooked;
private String postNumber;
private String postType;
private Integer postNumber;
private Integer postType;
private String updatedAt;
private Integer replyCount;
private String replyToPostNumber;
@ -79,19 +79,19 @@ public class Post {
this.cooked = cooked;
}
public String getPostNumber() {
public Integer getPostNumber() {
return postNumber;
}
public void setPostNumber(String postNumber) {
public void setPostNumber(Integer postNumber) {
this.postNumber = postNumber;
}
public String getPostType() {
public Integer getPostType() {
return postType;
}
public void setPostType(String postType) {
public void setPostType(Integer postType) {
this.postType = postType;
}