Skip to content

Commit

Permalink
THT-Server-179 그날의 주제 타입 추가(+ 하이라이트 텍스트, 주제 서두 데이터 추가) (#208)
Browse files Browse the repository at this point in the history
  • Loading branch information
thalals authored May 3, 2024
1 parent 0b31482 commit 8c05264
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ public class DailyFallingActiveInfo extends Auditable {
@Convert(converter = DailyFallingTypeConverter.class)
private DailyFallingType type;

public static DailyFallingActiveInfo of(final LocalDateTime start,
final LocalDateTime end, final DailyFallingType type) {
@Column
private String introduction;

public static DailyFallingActiveInfo of(final LocalDateTime start, final LocalDateTime end, final DailyFallingType type, final String introduction) {

return new DailyFallingActiveInfo(null, start, end, type);
return new DailyFallingActiveInfo(null, start, end, type, introduction);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public DailyFallingResponse getDailyFallingList() {
.map(DailyFallingTopicResponse::of)
.toList();

return DailyFallingResponse.of(activeInfo.get().getEndDateTime(), activeInfo.get().getType(), topicResponses);
return DailyFallingResponse.of(activeInfo.get().getEndDateTime(), activeInfo.get().getType(), activeInfo.get().getIntroduction(), topicResponses);
}

public void chooseDailyFallingKeyword(final long dailyFallingIdx, final String userUuid) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,22 @@
public record DailyFallingResponse(
long expirationUnixTime,
String type,
String introduction,
List<DailyFallingTopicResponse> fallingTopicList
) {

public static DailyFallingResponse empty() {
String empty = "";
return new DailyFallingResponse(-1, empty, List.of());
return new DailyFallingResponse(-1, empty, empty, List.of());
}

public static DailyFallingResponse of(final LocalDateTime endDateTime, final DailyFallingType type,
final List<DailyFallingTopicResponse> topicResponses) {
final String introduction, final List<DailyFallingTopicResponse> topicResponses) {

return new DailyFallingResponse(
UnixTimeUtils.convertUnixTimeForUTC(endDateTime),
type.getValue(),
introduction,
topicResponses
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private void setUpCreateUser() {
final TalkKeyword talkKeyword = talkKeywordRepository.save(TalkKeyword.of(1, "주제어"));

final DailyFallingActiveInfo timeTable = dailyFallingActiveTimeTableRepository.save(
DailyFallingActiveInfo.of(now.minusDays(1), now.plusDays(1), DailyFallingType.ONE_CHOICE));
DailyFallingActiveInfo.of(now.minusDays(1), now.plusDays(1), DailyFallingType.ONE_CHOICE, "오늘 나는 너랑.."));

return dailyFallingRepository.save(
DailyFalling.of(talkKeyword.getIdx(), timeTable.getIdx(), "잡담내용~~ 잡담~")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ void getDailyFallingList() throws Exception {
.description("폴링 주제어 만료시간 [존재하지 않으면 -1]"),
fieldWithPath("type").type(JsonFieldType.STRING)
.description(String.format("그날의 대화주제 표출 형식 - ex %s", EnumDocsUtils.getTypesFieldList(DailyFallingType.class))),
fieldWithPath("introduction").type(JsonFieldType.STRING).description("그날의 주제어 서두"),
fieldWithPath("fallingTopicList").type(JsonFieldType.ARRAY)
.description("폴링 주제어 라수투 [존재하지 않으면 빈 리스트 [] "),
fieldWithPath("fallingTopicList[].idx").type(JsonFieldType.NUMBER).description("데일리 폴링 토픽 idx"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void emptyValue() {
void convertUnix() {
LocalDateTime localDateTime = LocalDateTime.of(2023, 6, 26, 11, 0, 0);

DailyFallingResponse response = DailyFallingResponse.of(localDateTime, DailyFallingType.ONE_CHOICE, List.of());
DailyFallingResponse response = DailyFallingResponse.of(localDateTime, DailyFallingType.ONE_CHOICE, "", List.of());

assertThat(response.expirationUnixTime()).isEqualTo(1687744800);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.tht.api.app.entity.enums.DailyFallingType;
import com.tht.api.app.facade.main.response.DailyFallingResponse;
import com.tht.api.app.facade.main.response.DailyFallingTopicResponse;

import java.util.List;

public class DailyFallingResponseFixture {
Expand All @@ -15,6 +16,7 @@ public class DailyFallingResponseFixture {
private static final String talkIssue = "키워드 파생질문 - 이런이런 주제로 이야기해볼까요~";
private static final long expirationTime = 1687744800;
private static final DailyFallingType type = DailyFallingType.ONE_CHOICE;
private static final String introduction = "오늘 나는 너랑..";

public static DailyFallingTopicResponse makeTopic() {
return new DailyFallingTopicResponse(idx, keyword, keywordIdx, keywordImgUrl, talkIssue);
Expand All @@ -25,6 +27,6 @@ public static List<DailyFallingTopicResponse> makeTopicList() {
}

public static DailyFallingResponse make() {
return new DailyFallingResponse(expirationTime, type.getValue(), makeTopicList());
return new DailyFallingResponse(expirationTime, type.getValue(), introduction, makeTopicList());
}
}

0 comments on commit 8c05264

Please sign in to comment.