-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[Feat] #282 - 소셜 API 구현
- Loading branch information
Showing
17 changed files
with
162 additions
and
13 deletions.
There are no files selected for viewing
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
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
2 changes: 1 addition & 1 deletion
2
...ive/dto/response/HistoryKeyResultDto.java → ...response/history/HistoryKeyResultDto.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
3 changes: 2 additions & 1 deletion
3
...dto/response/HistoryObjectiveListDto.java → ...onse/history/HistoryObjectiveListDto.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
2 changes: 1 addition & 1 deletion
2
...tive/dto/response/HistoryResponseDto.java → .../response/history/HistoryResponseDto.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
2 changes: 1 addition & 1 deletion
2
...bjective/dto/response/HistoryTaskDto.java → .../dto/response/history/HistoryTaskDto.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
3 changes: 2 additions & 1 deletion
3
...dto/response/ObjectiveGroupByYearDto.java → ...onse/history/ObjectiveGroupByYearDto.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
2 changes: 1 addition & 1 deletion
2
...nshot/objective/dto/response/YearDto.java → ...jective/dto/response/history/YearDto.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
35 changes: 35 additions & 0 deletions
35
...shot-api/src/main/java/org/moonshot/objective/dto/response/social/SocialKeyResultDto.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,35 @@ | ||
package org.moonshot.objective.dto.response.social; | ||
|
||
import org.moonshot.keyresult.model.KeyResult; | ||
|
||
import java.time.format.DateTimeFormatter; | ||
import java.util.List; | ||
|
||
public record SocialKeyResultDto( | ||
String krTitle, | ||
String krStartAt, | ||
String krExpireAt, | ||
Long keyResultId, | ||
Integer krIdx, | ||
Long krTarget, | ||
String krMetric, | ||
List<SocialTaskDto> taskList | ||
) { | ||
public static SocialKeyResultDto of(KeyResult keyResult) { | ||
return getSocialKeyResultDto(keyResult); | ||
} | ||
|
||
private static SocialKeyResultDto getSocialKeyResultDto(KeyResult keyResult) { | ||
return new SocialKeyResultDto( | ||
keyResult.getTitle(), | ||
keyResult.getPeriod().getStartAt().format(DateTimeFormatter.ISO_LOCAL_DATE), | ||
keyResult.getPeriod().getExpireAt().format(DateTimeFormatter.ISO_LOCAL_DATE), | ||
keyResult.getId(), | ||
keyResult.getIdx(), | ||
keyResult.getTarget(), | ||
keyResult.getMetric(), | ||
keyResult.getTaskList().stream().map(SocialTaskDto::of).toList() | ||
); | ||
} | ||
} | ||
|
26 changes: 26 additions & 0 deletions
26
...ot-api/src/main/java/org/moonshot/objective/dto/response/social/SocialOKRResponseDto.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,26 @@ | ||
package org.moonshot.objective.dto.response.social; | ||
|
||
import org.moonshot.objective.model.Objective; | ||
import org.moonshot.user.model.User; | ||
|
||
public record SocialOKRResponseDto( | ||
String category, | ||
String userName, | ||
String userImg, | ||
Long like, | ||
String userIntro, | ||
SocialObjectiveDto okrTreeData | ||
) { | ||
public static SocialOKRResponseDto of(Objective objective) { | ||
return new SocialOKRResponseDto( | ||
objective.getCategory().getValue(), | ||
objective.getUser().getNickname(), | ||
objective.getUser().getImageUrl(), | ||
objective.getHeartCount(), | ||
objective.getUser().getDescription(), | ||
SocialObjectiveDto.of(objective) | ||
); | ||
} | ||
|
||
} | ||
|
26 changes: 26 additions & 0 deletions
26
...shot-api/src/main/java/org/moonshot/objective/dto/response/social/SocialObjectiveDto.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,26 @@ | ||
package org.moonshot.objective.dto.response.social; | ||
|
||
import org.moonshot.objective.model.Objective; | ||
|
||
import java.time.format.DateTimeFormatter; | ||
import java.util.List; | ||
|
||
public record SocialObjectiveDto( | ||
String objTitle, | ||
String objCategory, | ||
String objContent, | ||
String objStartAt, | ||
String objExpireAt, | ||
List<SocialKeyResultDto> krList | ||
) { | ||
public static SocialObjectiveDto of(Objective objective) { | ||
return new SocialObjectiveDto( | ||
objective.getTitle(), | ||
objective.getCategory().getValue(), | ||
objective.getContent(), | ||
objective.getPeriod().getStartAt().format(DateTimeFormatter.ISO_LOCAL_DATE), | ||
objective.getPeriod().getExpireAt().format(DateTimeFormatter.ISO_LOCAL_DATE), | ||
objective.getKeyResultList().stream().map(SocialKeyResultDto::of).toList() | ||
); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
moonshot-api/src/main/java/org/moonshot/objective/dto/response/social/SocialTaskDto.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,15 @@ | ||
package org.moonshot.objective.dto.response.social; | ||
|
||
import org.moonshot.task.model.Task; | ||
|
||
public record SocialTaskDto( | ||
String taskTitle, | ||
Integer taskIdx | ||
) { | ||
public static SocialTaskDto of(Task task) { | ||
return new SocialTaskDto( | ||
task.getTitle(), | ||
task.getIdx() | ||
); | ||
} | ||
} |
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
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
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
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
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