Skip to content

Commit

Permalink
docs: redis 위치 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
angelSuho committed Jun 14, 2023
1 parent 6db12ec commit 8e8986e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
11 changes: 0 additions & 11 deletions src/main/java/project/trendpick_pro/domain/common/base/rq/Rq.java
Original file line number Diff line number Diff line change
Expand Up @@ -181,17 +181,6 @@ public Optional<Member> CheckLogin() {
}
}

public RsData<Member> RsCheckLogin() {

String username = SecurityContextHolder.getContext().getAuthentication().getName(); // 둘다 테스트 해보기
Optional<Member> member = memberService.findByEmail(username);

if (memberService.findByEmail(member.get().getEmail()).isPresent()) {
return RsData.of("F-1", "로그인된 상태가 아닙니다.", member.get());
}
return RsData.of("S-1", "추천 카테고리입니다.", member.get());
}

public boolean checkLogin(){
String username = SecurityContextHolder.getContext().getAuthentication().getName(); // 둘다 테스트 해보기
Optional<Member> member = memberService.findByEmail(username);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
Expand All @@ -21,6 +22,7 @@
import project.trendpick_pro.domain.common.base.rq.Rq;
import project.trendpick_pro.domain.member.entity.Member;
import project.trendpick_pro.domain.member.exception.MemberNotFoundException;
import project.trendpick_pro.domain.member.service.MemberService;
import project.trendpick_pro.domain.product.entity.Product;
import project.trendpick_pro.domain.product.entity.dto.request.ProductSaveRequest;
import project.trendpick_pro.domain.product.entity.dto.response.ProductListResponseBySeller;
Expand All @@ -45,6 +47,7 @@ public class ProductController {

private final ProductService productService;
private final RecommendService recommendService;
private final MemberService memberService;

private final TagNameService tagNameService;
private final BrandService brandService;
Expand Down Expand Up @@ -147,16 +150,17 @@ public String showAllProduct(@RequestParam(value = "page", defaultValue = "0") i
mainCategory = "상의";
}
if (mainCategory.equals("추천")) {
RsData<Member> member = rq.RsCheckLogin();
if (member.isFail()) {
String username = SecurityContextHolder.getContext().getAuthentication().getName();
Optional<Member> member = memberService.findByEmail(username);
if (member.isPresent()) {
model.addAttribute("subCategoryName", subCategory);
model.addAttribute("mainCategoryName", mainCategory);
model.addAttribute("productResponses", productService.showAll(offset, mainCategory, subCategory));
model.addAttribute("subCategories", subCategoryService.findAll(mainCategory));
} else {
model.addAttribute("subCategoryName", subCategory);
model.addAttribute("mainCategoryName", mainCategory);
model.addAttribute("productResponses", recommendService.getFindAll(member.getData(), offset));
model.addAttribute("productResponses", recommendService.getFindAll(member.get(), offset));
model.addAttribute("subCategories", subCategoryService.findAll(mainCategory));
}
} else if(mainCategory.equals("전체")){
Expand Down

0 comments on commit 8e8986e

Please sign in to comment.