-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
src/main/java/com/snsIntegrationFeedService/post/CountType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.snsIntegrationFeedService.post; | ||
|
||
public enum CountType { | ||
count, view_count, like_count, share_count | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/java/com/snsIntegrationFeedService/post/DateType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.snsIntegrationFeedService.post; | ||
|
||
public enum DateType { | ||
date, hour | ||
} |
31 changes: 31 additions & 0 deletions
31
src/main/java/com/snsIntegrationFeedService/post/dto/request/CreatePostRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.snsIntegrationFeedService.post.dto.request; | ||
|
||
import com.snsIntegrationFeedService.post.entity.Post; | ||
import com.snsIntegrationFeedService.post.entity.PostTypeEnum; | ||
import com.snsIntegrationFeedService.user.entity.User; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
@AllArgsConstructor | ||
@Getter | ||
public class CreatePostRequest { | ||
|
||
private PostTypeEnum type; | ||
|
||
private String title; | ||
|
||
private String content; | ||
|
||
private String hashtag; | ||
|
||
|
||
public Post toEntity(User user, CreatePostRequest request) { | ||
return Post.builder() | ||
.user(user) | ||
.type(request.type) | ||
.title(request.title) | ||
.content(request.content) | ||
.build(); | ||
} | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
src/main/java/com/snsIntegrationFeedService/post/dto/request/StaticsRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.snsIntegrationFeedService.post.dto.request; | ||
|
||
import com.snsIntegrationFeedService.post.CountType; | ||
import com.snsIntegrationFeedService.post.DateType; | ||
import java.util.Date; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.Getter; | ||
|
||
@Data | ||
public class StaticsRequest { | ||
private CountType value; | ||
private DateType type; | ||
private String hashtag; | ||
private Date start; | ||
private Date end; | ||
|
||
public StaticsRequest(CountType value, DateType type, String hashtag, Date start, Date end) { | ||
this.value = (value != null) ? value : CountType.count; | ||
this.type = type; | ||
this.hashtag = (hashtag != null) ? hashtag : "본인계정"; | ||
this.start = start; | ||
this.end = end; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/com/snsIntegrationFeedService/post/dto/response/StaticsResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.snsIntegrationFeedService.post.dto.response; | ||
|
||
import com.snsIntegrationFeedService.post.entity.Post; | ||
import java.util.Date; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@AllArgsConstructor | ||
//@NoArgsConstructor | ||
@Getter | ||
@Builder | ||
public class StaticsResponse { | ||
|
||
private Date date; | ||
|
||
private long num; | ||
|
||
public static StaticsResponse from(Date date, int num) { | ||
return StaticsResponse.builder() | ||
.date(date) | ||
.num(num) | ||
.build(); | ||
} | ||
|
||
} |