Skip to content

Commit

Permalink
TT-221 modify script redis적용
Browse files Browse the repository at this point in the history
  • Loading branch information
snacktime81 committed Jul 10, 2024
1 parent ad32544 commit cd567ff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.twentythree.peech.common.dto.request.GPTRequest;
import com.twentythree.peech.common.dto.response.GPTResponse;
import com.twentythree.peech.script.cache.CacheService;
import com.twentythree.peech.script.domain.*;
import com.twentythree.peech.script.dto.*;
import com.twentythree.peech.script.dto.response.MajorScriptsResponseDTO;
Expand Down Expand Up @@ -38,7 +39,7 @@ public class ScriptService {
private final ThemeRepository themeRepository;
private final VersionRepository versionRepository;
private final SentenceRepository sentenceRepository;
private final ScriptInMemoryRepository scriptRedisRepository;
private final CacheService scriptRedisRepository;

@Transactional
public SaveScriptDTO saveInputScript(Long themeId, String[] paragraphs) {
Expand Down Expand Up @@ -206,11 +207,11 @@ public ModifyScriptResponseDTO modifyScriptService(List<ParagraphDTO> modifiedPa
Long newSentenceId = redisSentenceMap.getKey().getSentenceId();
RedisSentenceDTO newSentence = redisSentenceMap.getValue();

scriptRedisRepository.setKeySentenceIdValueSentenceInformations(newSentenceId, newSentence);
scriptRedisRepository.saveSentenceInfo(newSentenceId, newSentence);
newSentenceIds.add(newSentenceId);

}
scriptRedisRepository.setKeyUserValueSentenceIds("user"+userId, newSentenceIds);
scriptRedisRepository.saveSentencesIdList("user"+userId, newSentenceIds);

}
return new ModifyScriptResponseDTO(modifiedParagraphList);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.twentythree.peech.script.cache.RedisTemplateImpl;
import com.twentythree.peech.script.dto.SaveRedisSentenceInfoDto;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
Expand Down Expand Up @@ -39,6 +40,7 @@ public class ScriptRedisTemplateImplTest {
}

@Test
@Disabled
public void 문장_정보_저장() throws Exception {
List<SaveRedisSentenceInfoDto> sentencesInfoList = List.of(
new SaveRedisSentenceInfoDto(1L, 1L, 1L, "sentence1", 1L, LocalTime.of(0, 0, 12), false),
Expand Down

0 comments on commit cd567ff

Please sign in to comment.