Skip to content

Commit

Permalink
update diary my list
Browse files Browse the repository at this point in the history
  • Loading branch information
InBackSu committed Jan 1, 2024
1 parent 241e1af commit 2523bfc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
import com.gapple.weeingback.domain.member.repository.MemberRepository;
import com.gapple.weeingback.global.exception.MemberNotFoundException;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.UUID;

@Slf4j
@Service
@RequiredArgsConstructor
public class DiaryServiceImpl implements DiaryService {
Expand Down Expand Up @@ -61,11 +63,12 @@ public DiaryListResponse listDiary(DiaryListRequest request) {

@Override
public DiaryMyListResponse myListDiary() {
String id = SecurityContextHolder.getContext().getAuthentication().getName();

Member member = memberRepository.findMemberById(UUID.fromString(id)).orElseThrow(MemberNotFoundException::new);
UUID id = UUID.fromString(SecurityContextHolder.getContext().getAuthentication().getName());
Member member = memberRepository.findMemberById(id).orElseThrow(MemberNotFoundException::new);
List<Diary> diaries = member.getDiaries();

log.info(diaries.toString());

return new DiaryMyListResponse(diaries);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class Member implements GrantedAuthority {
@JoinColumn(name = "consulting_id")
private List<Consulting> consulting;

@OneToMany
@OneToMany(fetch = FetchType.EAGER)
@JoinColumn(name = "diary_id")
private List<Diary> diaries;

Expand Down
5 changes: 4 additions & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,7 @@ jwt:
redis:
host: ${REDIS_HOST}
port: ${REDIS_PORT}
auth: ${REDIS_AUTH}
auth: ${REDIS_AUTH}

server:
port: 8082

0 comments on commit 2523bfc

Please sign in to comment.