Skip to content

Commit

Permalink
Merge pull request #92 from KUSITMS-MOAMOA/chore/#90
Browse files Browse the repository at this point in the history
[Chore/#90] 경험 기록 리스트 반환 개수 수정 & 메모 임시 저장 내역 조회 오류 해결
  • Loading branch information
daeun084 authored Nov 17, 2024
2 parents a8a0aa8 + 3f9c3a9 commit f07c494
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public void parseAndSaveAbilities(Map<String, String> keywordList, Analysis anal
}
}

@Transactional
public void deleteOriginAbilityList(Analysis analysis) {
List<Ability> abilityList = analysis.getAbilityList();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ public Analysis recreateAnalysis(Record record, User user) {
* @param recordId
* @return
*/
@Transactional
public AnalysisResponse.AnalysisDto postAnalysis(Long userId, Long recordId) {
User user = findUserById(userId);
Record record = findRecordById(recordId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class RecordService {
private final UserRepository userRepository;
private final AnalysisService analysisService;
private final ChatRoomRepository chatRoomRepository;
private final int listSize = 20;
private final int listSize = 30;

/*
* user의 MEMO ver. 경험을 기록하고 폴더를 지정한 후 생성된 경험 기록 정보를 반환
Expand Down Expand Up @@ -126,7 +126,7 @@ public RecordResponse.TmpMemoRecordDto getTmpMemoRecord(Long userId) {
}

// 임시 저장 내역이 있는 경우 결과 조회
Record tmpMemoRecord = findRecordById(tmpMemoRecordId);
Record tmpMemoRecord = findTmpRecordById(tmpMemoRecordId);

// 기존 데이터 제거 후 결과 반환
user.deleteTmpMemo();
Expand Down Expand Up @@ -248,6 +248,11 @@ private Record findRecordById(Long recordId) {
.orElseThrow(() -> new RecordException(RecordErrorStatus.RECORD_NOT_FOUND));
}

private Record findTmpRecordById(Long recordId) {
return recordRepository.findById(recordId)
.orElseThrow(() -> new RecordException(RecordErrorStatus.RECORD_NOT_FOUND));
}

private List<Record> findRecordListByFolder(User user, Folder folder, Long lastRecordId) {
Pageable pageable = PageRequest.of(0, listSize + 1, Sort.by("createdAt").descending());
return recordRepository.findRecordsByFolder(folder, user, lastRecordId, pageable);
Expand All @@ -259,7 +264,7 @@ private List<Record> findRecordList(User user, Long lastRecordId) {
}

private List<Record> findRecordListOrderByCreatedAt(User user) {
Pageable pageable = PageRequest.of(0, 3, Sort.by("createdAt").descending());
Pageable pageable = PageRequest.of(0, 9, Sort.by("createdAt").descending());
return recordRepository.findRecordsOrderByCreatedAt(user, pageable);
}

Expand Down

0 comments on commit f07c494

Please sign in to comment.