diff --git a/src/main/java/com/moabam/api/application/coupon/CouponManageService.java b/src/main/java/com/moabam/api/application/coupon/CouponManageService.java index f4d1ef92..d4a070fc 100644 --- a/src/main/java/com/moabam/api/application/coupon/CouponManageService.java +++ b/src/main/java/com/moabam/api/application/coupon/CouponManageService.java @@ -4,7 +4,6 @@ import java.util.Optional; import java.util.Set; -import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; import com.moabam.api.domain.coupon.Coupon; @@ -33,7 +32,7 @@ public class CouponManageService { private final CouponManageRepository couponManageRepository; private final CouponWalletRepository couponWalletRepository; - @Scheduled(fixedDelay = 1000) + // @Scheduled(fixedDelay = 1000) public void issue() { LocalDate now = clockHolder.date(); Optional isCoupon = couponRepository.findByStartAt(now); diff --git a/src/main/java/com/moabam/api/domain/item/repository/ItemSearchRepository.java b/src/main/java/com/moabam/api/domain/item/repository/ItemSearchRepository.java index f2b0f150..14a62b7e 100644 --- a/src/main/java/com/moabam/api/domain/item/repository/ItemSearchRepository.java +++ b/src/main/java/com/moabam/api/domain/item/repository/ItemSearchRepository.java @@ -1,7 +1,7 @@ package com.moabam.api.domain.item.repository; -import static com.moabam.api.domain.item.QInventory.*; -import static com.moabam.api.domain.item.QItem.*; +import static com.moabam.api.domain.item.QInventory.inventory; +import static com.moabam.api.domain.item.QItem.item; import java.util.List; @@ -10,7 +10,6 @@ import com.moabam.api.domain.item.Item; import com.moabam.api.domain.item.ItemType; import com.moabam.global.common.util.DynamicQuery; -import com.querydsl.core.types.dsl.BooleanExpression; import com.querydsl.jpa.impl.JPAQueryFactory; import lombok.RequiredArgsConstructor; @@ -24,10 +23,12 @@ public class ItemSearchRepository { public List findNotPurchasedItems(Long memberId, ItemType type) { return jpaQueryFactory.selectFrom(item) .leftJoin(inventory) - .on(inventory.item.id.eq(item.id)) + .on(inventory.item.id.eq(item.id) + .and(inventory.memberId.eq(memberId))) .where( DynamicQuery.generateEq(type, item.type::eq), - DynamicQuery.generateEq(memberId, this::filterByMemberId)) + inventory.memberId.isNull() + ) .orderBy( item.unlockLevel.asc(), item.bugPrice.asc(), @@ -35,9 +36,4 @@ public List findNotPurchasedItems(Long memberId, ItemType type) { item.name.asc()) .fetch(); } - - private BooleanExpression filterByMemberId(Long memberId) { - return inventory.memberId.isNull() - .or(inventory.memberId.ne(memberId)); - } } diff --git a/src/main/resources/sql/data.sql b/src/main/resources/sql/data.sql index dfaec72c..7ed20150 100644 --- a/src/main/resources/sql/data.sql +++ b/src/main/resources/sql/data.sql @@ -11,7 +11,7 @@ values ('MORNING', 'SKIN', '오목눈이', 'https://image.moabam.com/moabam/skin 'https://image.moabam.com/moabam/skins/omok/default/eyes-closed.png', 1, current_time()); insert into item (type, category, name, awake_image, sleep_image, unlock_level, created_at) -values ('MORNING', 'SKIN', '부엉이', 'https://image.moabam.com/moabam/skins/owl/default/eyes-opened.png', +values ('NIGHT', 'SKIN', '부엉이', 'https://image.moabam.com/moabam/skins/owl/default/eyes-opened.png', 'https://image.moabam.com/moabam/skins/owl/default/eyes-closed.png', 1, current_time()); insert into item (type, category, name, awake_image, sleep_image, bug_price, golden_bug_price, unlock_level, created_at) @@ -19,7 +19,7 @@ values ('MORNING', 'SKIN', '안경 오목눈이', 'https://image.moabam.com/moab 'https://image.moabam.com/moabam/skins/omok/glasses/eyes-closed', 10, 5, 5, current_time()); insert into item (type, category, name, awake_image, sleep_image, bug_price, golden_bug_price, unlock_level, created_at) -values ('MORNING', 'SKIN', '안경 부엉이', 'https://image.moabam.com/moabam/skins/owl/glasses/eyes-opened.png', +values ('NIGHT', 'SKIN', '안경 부엉이', 'https://image.moabam.com/moabam/skins/owl/glasses/eyes-opened.png', 'https://image.moabam.com/moabam/skins/owl/glasses/eyes-closed', 10, 5, 5, current_time()); insert into item (type, category, name, awake_image, sleep_image, bug_price, golden_bug_price, unlock_level, created_at) @@ -27,7 +27,7 @@ values ('MORNING', 'SKIN', '목도리 오목눈이', 'https://image.moabam.com/m 'https://image.moabam.com/moabam/skins/omok/scarf/eyes-closed', 20, 10, 10, current_time()); insert into item (type, category, name, awake_image, sleep_image, bug_price, golden_bug_price, unlock_level, created_at) -values ('MORNING', 'SKIN', '목도리 부엉이', 'https://image.moabam.com/moabam/skins/owl/scarf/eyes-opened.png', +values ('NIGHT', 'SKIN', '목도리 부엉이', 'https://image.moabam.com/moabam/skins/owl/scarf/eyes-opened.png', 'https://image.moabam.com/moabam/skins/owl/scarf/eyes-closed', 20, 10, 10, current_time()); insert into item (type, category, name, awake_image, sleep_image, bug_price, golden_bug_price, unlock_level, created_at) @@ -35,5 +35,5 @@ values ('MORNING', 'SKIN', '산타 오목눈이', 'https://image.moabam.com/moab 'https://image.moabam.com/moabam/skins/omok/scarf/eyes-closed', 30, 15, 15, current_time()); insert into item (type, category, name, awake_image, sleep_image, bug_price, golden_bug_price, unlock_level, created_at) -values ('MORNING', 'SKIN', '산타 부엉이', 'https://image.moabam.com/moabam/skins/owl/santa/eyes-opened.png', +values ('NIGHT', 'SKIN', '산타 부엉이', 'https://image.moabam.com/moabam/skins/owl/santa/eyes-opened.png', 'https://image.moabam.com/moabam/skins/owl/santa/eyes-closed', 30, 15, 15, current_time());