Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug/210 #214

Merged
merged 2 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ public void init(){
@Transactional
public OAuthResult.OAuthResultDto SocialLogin(MemberRequestDto.OAuthRequestDto request,String type) {
Member member = memberRepository.findByEmail(request.getEmail()).orElse(null);

request.toString();
if(member != null) {
String accessToken = null;
Optional<FcmToken> fcmToken = fcmTokenRepository.findByTokenAndSerialNumber(request.getFcmToken(), request.getSerialNumber());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -567,46 +567,46 @@ public Page<Recipe> recipeListByCategory(Long categoryId, Integer pageIndex, Mem
if(recipeCategory.isEmpty())
throw new RecipeException(CommonStatus.RECIPE_NOT_FOUND);

QRecipe qRecipe = recipe;
QRecipeCategoryMapping qRecipeCategoryMapping = recipeCategoryMapping;
QFollow qFollow = follow;

//팔로잉 레시피 갯수 계산(일주일 전 것까지)
Long followingCount = queryFactory
.select(recipe.count())
.from(recipe)
.join(recipe.categoryMappingList, recipeCategoryMapping).fetchJoin()
.where(blockedMemberNotInForRecipe(member),
recipeCategoryMapping.category.id.eq(categoryId),
getFollowerRecipeCondition(member),
recipe.createdAt.after(LocalDateTime.now().minusWeeks(1))
)
.fetchOne();

// QRecipe qRecipe = recipe;
// QRecipeCategoryMapping qRecipeCategoryMapping = recipeCategoryMapping;
// QFollow qFollow = follow;
//
// //팔로잉 레시피 갯수 계산(일주일 전 것까지)
// Long followingCount = queryFactory
// .select(recipe.count())
// .from(recipe)
// .join(recipe.categoryMappingList, recipeCategoryMapping).fetchJoin()
// .where(blockedMemberNotInForRecipe(member),
// recipeCategoryMapping.category.id.eq(categoryId),
// getFollowerRecipeCondition(member),
// recipe.createdAt.after(LocalDateTime.now().minusWeeks(1))
// )
// .fetchOne();
//
List<Recipe> content = new ArrayList<>();

if(followingCount >= pageIndex*pageSize){
//index를 넘지 않으면 팔로잉 레시피 먼저
content = queryFactory
.selectFrom(recipe)
.join(recipe.categoryMappingList, recipeCategoryMapping).fetchJoin()
.where(blockedMemberNotInForRecipe(member),
recipeCategoryMapping.category.id.eq(categoryId),
getFollowerRecipeCondition(member),
recipe.createdAt.after(LocalDateTime.now().minusWeeks(1))
)
.orderBy(recipe.createdAt.desc())
.offset(pageIndex*pageSize)
.limit(pageSize)
.fetch();

} else if(followingCount >(pageIndex-1)*pageSize) {
//index에 끼어있으면 팔로잉,일반 레시피 둘 다. offset과 pagesize 잘 계산해야함

} else{
//일반 레시피만. offset 잘 계산해야함

}
//
// if(followingCount >= pageIndex*pageSize){
// //index를 넘지 않으면 팔로잉 레시피 먼저
// content = queryFactory
// .selectFrom(recipe)
// .join(recipe.categoryMappingList, recipeCategoryMapping).fetchJoin()
// .where(blockedMemberNotInForRecipe(member),
// recipeCategoryMapping.category.id.eq(categoryId),
// getFollowerRecipeCondition(member),
// recipe.createdAt.after(LocalDateTime.now().minusWeeks(1))
// )
// .orderBy(recipe.createdAt.desc())
// .offset(pageIndex*pageSize)
// .limit(pageSize)
// .fetch();
//
// } else if(followingCount >(pageIndex-1)*pageSize) {
// //index에 끼어있으면 팔로잉,일반 레시피 둘 다. offset과 pagesize 잘 계산해야함
//
// } else{
// //일반 레시피만. offset 잘 계산해야함
//
// }


content = queryFactory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ public String toString() {
@Getter
@Setter
public static class OAuthRequestDto {
@Override
public String toString() {
return "OAuthRequestDto{" +
"email='" + email + '\'' +
", fcmToken='" + fcmToken + '\'' +
", serialNumber='" + serialNumber + '\'' +
'}';
}
private String email;
private String fcmToken;
private String serialNumber;
Expand Down
Loading