From 36becdf9d2348055c7a30e6c25c6fe372ea1f792 Mon Sep 17 00:00:00 2001 From: saewoo1 Date: Tue, 22 Oct 2024 16:19:59 +0900 Subject: [PATCH 01/25] =?UTF-8?q?FEAT:=20item=5Fhistory=20=ED=85=8C?= =?UTF-8?q?=EC=9D=B4=EB=B8=94=EC=97=90=20amount=20=EC=BB=AC=EB=9F=BC=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/database/cabi_local.sql | 1 + .../main/java/org/ftclub/cabinet/item/domain/ItemHistory.java | 2 ++ 2 files changed, 3 insertions(+) diff --git a/backend/database/cabi_local.sql b/backend/database/cabi_local.sql index 668508da5..6ba36289f 100644 --- a/backend/database/cabi_local.sql +++ b/backend/database/cabi_local.sql @@ -758,6 +758,7 @@ CREATE TABLE `item_history` `user_id` bigint(20) NOT NULL, `purchase_at` datetime(6) NOT NULL, `used_at` datetime(6) DEFAULT NULL, + `amount` bigint(20) DEFAULT NULL, PRIMARY KEY (`id`), CONSTRAINT `item_history_item_id` FOREIGN KEY (`item_id`) REFERENCES `item` (`id`), CONSTRAINT `item_history_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) diff --git a/backend/src/main/java/org/ftclub/cabinet/item/domain/ItemHistory.java b/backend/src/main/java/org/ftclub/cabinet/item/domain/ItemHistory.java index 2784a5f72..4cfd2f5c5 100644 --- a/backend/src/main/java/org/ftclub/cabinet/item/domain/ItemHistory.java +++ b/backend/src/main/java/org/ftclub/cabinet/item/domain/ItemHistory.java @@ -75,6 +75,8 @@ public class ItemHistory { @Column(name = "USER_ID", nullable = false) private Long userId; + @Column(name = "AMOUNT", nullable = true) + private Long amount; protected ItemHistory(long userId, long itemId, LocalDateTime usedAt) { this.userId = userId; From 74fb8757dfa20a5b5240966c023f211b63a2a082 Mon Sep 17 00:00:00 2001 From: saewoo1 Date: Tue, 22 Oct 2024 16:21:04 +0900 Subject: [PATCH 02/25] =?UTF-8?q?FEAT:=20item=20=ED=85=8C=EC=9D=B4?= =?UTF-8?q?=EB=B8=94=EC=97=90=20=EA=B4=80=EB=A6=AC=EC=9E=90=EC=9A=A9=20?= =?UTF-8?q?=EC=BD=94=EC=9D=B8=20=EC=A7=80=EA=B8=89=20=EC=95=84=EC=9D=B4?= =?UTF-8?q?=ED=85=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/database/cabi_local.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/database/cabi_local.sql b/backend/database/cabi_local.sql index 6ba36289f..3e5fbea6f 100644 --- a/backend/database/cabi_local.sql +++ b/backend/database/cabi_local.sql @@ -742,7 +742,8 @@ VALUES (1, 0, 'EXTENSION_PREV', 'EXTENSION'), (17, 200, 'ADMIN_REWARD_200', 'ADMIN_REWARD'), (18, 500, 'ADMIN_REWARD_500', 'ADMIN_REWARD'), (19, 1000, 'ADMIN_REWARD_1000', 'ADMIN_REWARD'), - (20, 2000, 'ADMIN_REWARD_2000', 'ADMIN_REWARD'); + (20, 2000, 'ADMIN_REWARD_2000', 'ADMIN_REWARD'), + (21, 0, 'ADMIN_REWARD_COIN', 'ADMIN_REWARD'); /*!40000 ALTER TABLE `item` ENABLE KEYS */; UNLOCK TABLES; From 4c49f8d9d687350b5c69f2486ffff3207afe9faf Mon Sep 17 00:00:00 2001 From: saewoo1 Date: Tue, 22 Oct 2024 17:32:49 +0900 Subject: [PATCH 03/25] =?UTF-8?q?FEAT:=20ItemHistory=20=EC=97=94=ED=8B=B0?= =?UTF-8?q?=ED=8B=B0=EC=97=90=20=EC=9E=84=EC=8B=9C=EC=A0=81=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EC=BD=94=EC=9D=B8=20=EA=B4=80=EB=A0=A8=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=EC=9E=90=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ftclub/cabinet/item/domain/ItemHistory.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/backend/src/main/java/org/ftclub/cabinet/item/domain/ItemHistory.java b/backend/src/main/java/org/ftclub/cabinet/item/domain/ItemHistory.java index 4cfd2f5c5..8b0c99da8 100644 --- a/backend/src/main/java/org/ftclub/cabinet/item/domain/ItemHistory.java +++ b/backend/src/main/java/org/ftclub/cabinet/item/domain/ItemHistory.java @@ -84,6 +84,13 @@ protected ItemHistory(long userId, long itemId, LocalDateTime usedAt) { this.usedAt = usedAt; } + protected ItemHistory(long userId, long itemId, LocalDateTime assignedAt, Long amount) { + this.userId = userId; + this.itemId = itemId; + this.usedAt = assignedAt; + this.amount = amount; + } + /** * @param userId 아이템을 사용한 유저 ID * @param itemId 사용된 아이템 ID @@ -98,6 +105,15 @@ public static ItemHistory of(long userId, long itemId, LocalDateTime usedAt) { return itemHistory; } + public static ItemHistory coin(Long userId, Long itemId, LocalDateTime assignedAt, + Long amount) { + ItemHistory itemHistory = new ItemHistory(userId, itemId, assignedAt, amount); + if (!itemHistory.isValid()) { + throw ExceptionStatus.INVALID_ARGUMENT.asControllerException(); + } + return itemHistory; + } + /** * 사용자 ID, 아이템 ID, 사용일자의 null 이 아닌지 확인합니다. * From 6955c8675825ed6086d55156adf9342bf5f2592a Mon Sep 17 00:00:00 2001 From: saewoo1 Date: Tue, 22 Oct 2024 17:33:52 +0900 Subject: [PATCH 04/25] =?UTF-8?q?FEAT:=20=EC=BD=94=EC=9D=B8=20=EC=A7=80?= =?UTF-8?q?=EA=B8=89=20=EC=BB=A8=ED=8A=B8=EB=A1=A4=EB=9F=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/item/controller/AdminItemController.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/backend/src/main/java/org/ftclub/cabinet/admin/item/controller/AdminItemController.java b/backend/src/main/java/org/ftclub/cabinet/admin/item/controller/AdminItemController.java index f3932160e..330134298 100644 --- a/backend/src/main/java/org/ftclub/cabinet/admin/item/controller/AdminItemController.java +++ b/backend/src/main/java/org/ftclub/cabinet/admin/item/controller/AdminItemController.java @@ -1,9 +1,9 @@ package org.ftclub.cabinet.admin.item.controller; import lombok.RequiredArgsConstructor; +import org.ftclub.cabinet.admin.dto.AdminCoinAssignRequestDto; import org.ftclub.cabinet.admin.dto.AdminItemHistoryPaginationDto; import org.ftclub.cabinet.admin.item.service.AdminItemFacadeService; -import org.ftclub.cabinet.admin.statistics.service.AdminStatisticsFacadeService; import org.ftclub.cabinet.auth.domain.AuthGuard; import org.ftclub.cabinet.auth.domain.AuthLevel; import org.ftclub.cabinet.dto.ItemAssignRequestDto; @@ -24,8 +24,6 @@ public class AdminItemController { private final AdminItemFacadeService adminItemFacadeService; - private final AdminStatisticsFacadeService adminStatisticsFacadeService; - @PostMapping("") @AuthGuard(level = AuthLevel.ADMIN_ONLY) @@ -41,6 +39,13 @@ public void assignItem(@RequestBody ItemAssignRequestDto itemAssignRequestDto) { itemAssignRequestDto.getItemSku()); } + @PostMapping("/assign/coin") + @AuthGuard(level = AuthLevel.ADMIN_ONLY) + public void assignCoin(@RequestBody AdminCoinAssignRequestDto coinAssignRequestDto) { + adminItemFacadeService.assignCoin(coinAssignRequestDto.getUserIds(), + coinAssignRequestDto.getSku(), coinAssignRequestDto.getAmount()); + } + /** * 특정 유저의 아이템 history 조회 * From 76e942b23cbe63f9e9c0b89c515ac97d8cbdd53a Mon Sep 17 00:00:00 2001 From: saewoo1 Date: Tue, 22 Oct 2024 17:34:58 +0900 Subject: [PATCH 05/25] =?UTF-8?q?FEAT:=20=EC=96=B4=EB=93=9C=EB=AF=BC=20?= =?UTF-8?q?=EA=B3=84=EC=A0=95=EC=97=90=EC=84=9C=20=EC=97=AC=EB=9F=AC=20?= =?UTF-8?q?=EC=9C=A0=EC=A0=80=EC=97=90=EA=B2=8C=20=EC=9B=90=ED=95=98?= =?UTF-8?q?=EB=8A=94=20=EC=96=91=EB=A7=8C=ED=81=BC=20=EC=BD=94=EC=9D=B8=20?= =?UTF-8?q?=EC=A7=80=EA=B8=89=20=EA=B8=B0=EB=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ItemHistory 테이블에 amount 컬럼 추가 --- .../admin/dto/AdminCoinAssignRequestDto.java | 15 +++++++++++++++ .../item/service/AdminItemFacadeService.java | 10 ++++++++++ .../item/service/ItemHistoryCommandService.java | 17 +++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 backend/src/main/java/org/ftclub/cabinet/admin/dto/AdminCoinAssignRequestDto.java diff --git a/backend/src/main/java/org/ftclub/cabinet/admin/dto/AdminCoinAssignRequestDto.java b/backend/src/main/java/org/ftclub/cabinet/admin/dto/AdminCoinAssignRequestDto.java new file mode 100644 index 000000000..764d225c9 --- /dev/null +++ b/backend/src/main/java/org/ftclub/cabinet/admin/dto/AdminCoinAssignRequestDto.java @@ -0,0 +1,15 @@ +package org.ftclub.cabinet.admin.dto; + +import java.util.List; +import lombok.AllArgsConstructor; +import lombok.Getter; +import org.ftclub.cabinet.item.domain.Sku; + +@Getter +@AllArgsConstructor +public class AdminCoinAssignRequestDto { + + private List userIds; + private Sku sku; + private Long amount; +} diff --git a/backend/src/main/java/org/ftclub/cabinet/admin/item/service/AdminItemFacadeService.java b/backend/src/main/java/org/ftclub/cabinet/admin/item/service/AdminItemFacadeService.java index d8c456f03..be8d3960e 100644 --- a/backend/src/main/java/org/ftclub/cabinet/admin/item/service/AdminItemFacadeService.java +++ b/backend/src/main/java/org/ftclub/cabinet/admin/item/service/AdminItemFacadeService.java @@ -63,6 +63,16 @@ public void assignItem(List userIds, Sku sku) { itemHistoryCommandService.createItemHistories(userIds, item.getId(), now); } + @Transactional + public void assignCoin(List userIds, Sku sku, Long amount) { + Item item = itemQueryService.getBySku(sku); + LocalDateTime now = LocalDateTime.now(); + userIds.forEach(userId -> { + userCommandService.updateCoinAmount(userId, amount); + }); + itemHistoryCommandService.createCoinAssignHistory(userIds, item.getId(), now, amount); + } + @Transactional(readOnly = true) public AdminItemHistoryPaginationDto getUserItemHistories(Long userId, Pageable pageable) { Page itemHistoryWithItem = diff --git a/backend/src/main/java/org/ftclub/cabinet/item/service/ItemHistoryCommandService.java b/backend/src/main/java/org/ftclub/cabinet/item/service/ItemHistoryCommandService.java index 2863043c4..3319605d5 100644 --- a/backend/src/main/java/org/ftclub/cabinet/item/service/ItemHistoryCommandService.java +++ b/backend/src/main/java/org/ftclub/cabinet/item/service/ItemHistoryCommandService.java @@ -33,4 +33,21 @@ public void createCoinItemHistory(Long userId, Long itemId) { ItemHistory coinCollectItemHistory = ItemHistory.of(userId, itemId, LocalDateTime.now()); itemHistoryRepository.save(coinCollectItemHistory); } + + /** + * 관리자가 코인 지급 시 ItemHistory에 기록을 남깁니다 + * + * @param userIds + * @param itemId + * @param usedAt + * @param amount + */ + public void createCoinAssignHistory(List userIds, Long itemId, LocalDateTime usedAt, + Long amount) { + List itemHistories = userIds.stream() + .map(userId -> ItemHistory.coin(userId, itemId, usedAt, amount)) + .collect(Collectors.toList()); + + itemHistoryRepository.saveAll(itemHistories); + } } From b3c24635d3a4c6f292211286ad9b14045047b5ef Mon Sep 17 00:00:00 2001 From: saewoo1 Date: Fri, 25 Oct 2024 15:06:01 +0900 Subject: [PATCH 06/25] =?UTF-8?q?FIX:=20amount=EB=A5=BC=20=EB=B0=9B?= =?UTF-8?q?=EB=8A=94=20=ED=8C=A9=ED=86=A0=EB=A6=AC=20=EB=A9=94=EC=84=9C?= =?UTF-8?q?=EB=93=9C=20=EC=97=90=EB=9F=AC=20=EB=B0=9C=EC=83=9D=20=EC=8B=9C?= =?UTF-8?q?=20asDomainException=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/org/ftclub/cabinet/item/domain/ItemHistory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/main/java/org/ftclub/cabinet/item/domain/ItemHistory.java b/backend/src/main/java/org/ftclub/cabinet/item/domain/ItemHistory.java index 8b0c99da8..2dc9195a1 100644 --- a/backend/src/main/java/org/ftclub/cabinet/item/domain/ItemHistory.java +++ b/backend/src/main/java/org/ftclub/cabinet/item/domain/ItemHistory.java @@ -109,7 +109,7 @@ public static ItemHistory coin(Long userId, Long itemId, LocalDateTime assignedA Long amount) { ItemHistory itemHistory = new ItemHistory(userId, itemId, assignedAt, amount); if (!itemHistory.isValid()) { - throw ExceptionStatus.INVALID_ARGUMENT.asControllerException(); + throw ExceptionStatus.INVALID_ARGUMENT.asDomainException(); } return itemHistory; } From af818cb33b584c1286510266a6b5a8bba1247e24 Mon Sep 17 00:00:00 2001 From: jnkeniaem Date: Fri, 25 Oct 2024 15:50:53 +0900 Subject: [PATCH 07/25] =?UTF-8?q?[FE]=20FEAT:=204=EC=B8=B5=20=EC=82=AC?= =?UTF-8?q?=EB=AC=BC=ED=95=A8=EC=97=90=EC=84=9C=20=EC=9D=B4=EB=8F=99?= =?UTF-8?q?=ED=95=98=EB=8A=94=20=EC=9C=A0=EC=A0=80=EB=93=A4=EC=97=90?= =?UTF-8?q?=EA=B2=8C=20=EC=BD=94=EC=9D=B8=20=EB=B0=8F=20=EC=95=84=EC=9D=B4?= =?UTF-8?q?=ED=85=9C=20=EC=A7=80=EA=B8=89=ED=95=98=EA=B8=B0=20=EC=9C=84?= =?UTF-8?q?=ED=95=B4=20api=20=ED=98=B8=EC=B6=9C=20=ED=95=A8=EC=88=98=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1=20#1695?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config | 2 +- .../src/Cabinet/api/axios/axios.custom.ts | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/config b/config index 93674bce3..0d3244f5b 160000 --- a/config +++ b/config @@ -1 +1 @@ -Subproject commit 93674bce354efe9ad8fb3a7a934bdbf5acd1d162 +Subproject commit 0d3244f5b700c2b735c13a73ed4e8868139b144f diff --git a/frontend/src/Cabinet/api/axios/axios.custom.ts b/frontend/src/Cabinet/api/axios/axios.custom.ts index 514135b75..8ff595ce2 100644 --- a/frontend/src/Cabinet/api/axios/axios.custom.ts +++ b/frontend/src/Cabinet/api/axios/axios.custom.ts @@ -922,6 +922,25 @@ export const axiosItemAssign = async ( } }; +const axiosCoinAssignURL = "v5/admin/items/assign/coin"; +export const axiosCoinAssign = async ( + itemSku: string, + userIds: number[], + amount: number +): Promise => { + try { + const response = await instance.post(axiosCoinAssignURL, { + itemSku, + userIds, + amount, + }); + return response; + } catch (error) { + logAxiosError(error, ErrorType.STORE, "아이템 지급 중 오류 발생", true); + throw error; + } +}; + const axiosGetUserItemsURL = "/v5/admin/items/users/"; export const axiosGetUserItems = async ( userId: number, From 2df4fe563260daf72146a32ff32ebfba9a7a865e Mon Sep 17 00:00:00 2001 From: saewoo1 Date: Fri, 25 Oct 2024 15:54:20 +0900 Subject: [PATCH 08/25] =?UTF-8?q?FEAT:=20=EC=97=AC=EB=9F=AC=20=EC=9C=A0?= =?UTF-8?q?=EC=A0=80=EC=97=90=EA=B2=8C=20=EB=8F=99=EC=9D=BC=ED=95=9C=20?= =?UTF-8?q?=EC=BD=94=EC=9D=B8=EC=9D=84=20=EC=A7=80=EA=B8=89=ED=95=98?= =?UTF-8?q?=EB=8A=94=20Bulk=20add=20=EA=B8=B0=EB=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cabinet/admin/item/service/AdminItemFacadeService.java | 4 +--- .../org/ftclub/cabinet/user/repository/UserRepository.java | 6 ++++++ .../org/ftclub/cabinet/user/service/UserCommandService.java | 5 +++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/backend/src/main/java/org/ftclub/cabinet/admin/item/service/AdminItemFacadeService.java b/backend/src/main/java/org/ftclub/cabinet/admin/item/service/AdminItemFacadeService.java index be8d3960e..1726c01f5 100644 --- a/backend/src/main/java/org/ftclub/cabinet/admin/item/service/AdminItemFacadeService.java +++ b/backend/src/main/java/org/ftclub/cabinet/admin/item/service/AdminItemFacadeService.java @@ -67,9 +67,7 @@ public void assignItem(List userIds, Sku sku) { public void assignCoin(List userIds, Sku sku, Long amount) { Item item = itemQueryService.getBySku(sku); LocalDateTime now = LocalDateTime.now(); - userIds.forEach(userId -> { - userCommandService.updateCoinAmount(userId, amount); - }); + userCommandService.addBulkUserCoin(userIds, amount); itemHistoryCommandService.createCoinAssignHistory(userIds, item.getId(), now, amount); } diff --git a/backend/src/main/java/org/ftclub/cabinet/user/repository/UserRepository.java b/backend/src/main/java/org/ftclub/cabinet/user/repository/UserRepository.java index 0a384bb73..cd495bac0 100644 --- a/backend/src/main/java/org/ftclub/cabinet/user/repository/UserRepository.java +++ b/backend/src/main/java/org/ftclub/cabinet/user/repository/UserRepository.java @@ -140,4 +140,10 @@ public interface UserRepository extends JpaRepository { @Query("SELECT u FROM User u WHERE u.deletedAt IS NULL") List findAllDeletedAtIsNull(); + + @Modifying(clearAutomatically = true) + @Query("UPDATE User u " + + "SET u.coin = u.coin + :amount " + + "WHERE u.id IN :userIds") + void updateBulkUserCoin(@Param("userIds") List userIds, @Param("amount") Long amount); } diff --git a/backend/src/main/java/org/ftclub/cabinet/user/service/UserCommandService.java b/backend/src/main/java/org/ftclub/cabinet/user/service/UserCommandService.java index 994e9f7b8..54b1f545a 100644 --- a/backend/src/main/java/org/ftclub/cabinet/user/service/UserCommandService.java +++ b/backend/src/main/java/org/ftclub/cabinet/user/service/UserCommandService.java @@ -1,6 +1,7 @@ package org.ftclub.cabinet.user.service; import java.time.LocalDateTime; +import java.util.List; import javax.transaction.Transactional; import lombok.RequiredArgsConstructor; import org.ftclub.cabinet.auth.domain.FtProfile; @@ -115,4 +116,8 @@ public void updateCoinAmount(Long userId, Long reward) { .orElseThrow(ExceptionStatus.NOT_FOUND_USER::asServiceException); user.addCoin(reward); } + + public void addBulkUserCoin(List userIds, Long amount) { + userRepository.updateBulkUserCoin(userIds, amount); + } } From ab10e9715d37733ba326a11e49af2a3870f06191 Mon Sep 17 00:00:00 2001 From: saewoo1 Date: Fri, 25 Oct 2024 16:04:15 +0900 Subject: [PATCH 09/25] =?UTF-8?q?REFACTOR:=20=EC=9D=BC=EA=B4=84=20?= =?UTF-8?q?=EC=A7=80=EA=B8=89=20=EC=84=9C=EB=B9=84=EC=8A=A4=EB=AA=85=20add?= =?UTF-8?q?BulkCoin=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cabinet/admin/item/service/AdminItemFacadeService.java | 2 +- .../org/ftclub/cabinet/user/service/UserCommandService.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/org/ftclub/cabinet/admin/item/service/AdminItemFacadeService.java b/backend/src/main/java/org/ftclub/cabinet/admin/item/service/AdminItemFacadeService.java index 1726c01f5..09d7514fc 100644 --- a/backend/src/main/java/org/ftclub/cabinet/admin/item/service/AdminItemFacadeService.java +++ b/backend/src/main/java/org/ftclub/cabinet/admin/item/service/AdminItemFacadeService.java @@ -67,7 +67,7 @@ public void assignItem(List userIds, Sku sku) { public void assignCoin(List userIds, Sku sku, Long amount) { Item item = itemQueryService.getBySku(sku); LocalDateTime now = LocalDateTime.now(); - userCommandService.addBulkUserCoin(userIds, amount); + userCommandService.addBulkCoin(userIds, amount); itemHistoryCommandService.createCoinAssignHistory(userIds, item.getId(), now, amount); } diff --git a/backend/src/main/java/org/ftclub/cabinet/user/service/UserCommandService.java b/backend/src/main/java/org/ftclub/cabinet/user/service/UserCommandService.java index 54b1f545a..c94c56710 100644 --- a/backend/src/main/java/org/ftclub/cabinet/user/service/UserCommandService.java +++ b/backend/src/main/java/org/ftclub/cabinet/user/service/UserCommandService.java @@ -117,7 +117,7 @@ public void updateCoinAmount(Long userId, Long reward) { user.addCoin(reward); } - public void addBulkUserCoin(List userIds, Long amount) { + public void addBulkCoin(List userIds, Long amount) { userRepository.updateBulkUserCoin(userIds, amount); } } From 0c5b6f492d80e61ac1f19cf5195d1e7bfc0d1248 Mon Sep 17 00:00:00 2001 From: saewoo1 Date: Fri, 25 Oct 2024 16:42:38 +0900 Subject: [PATCH 10/25] =?UTF-8?q?REFACTOR:=20=EA=B4=80=EB=A6=AC=EC=9E=90?= =?UTF-8?q?=EA=B0=80=20=EC=9C=A0=EC=A0=80=EC=97=90=EA=B2=8C=20=EC=BD=94?= =?UTF-8?q?=EC=9D=B8=20=EC=95=84=EC=9D=B4=ED=85=9C=20=EC=A7=80=EA=B8=89=20?= =?UTF-8?q?=EC=8B=9C=20redis=20=EB=B6=80=EB=B6=84=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../item/service/AdminItemFacadeService.java | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/backend/src/main/java/org/ftclub/cabinet/admin/item/service/AdminItemFacadeService.java b/backend/src/main/java/org/ftclub/cabinet/admin/item/service/AdminItemFacadeService.java index 09d7514fc..85dcabf86 100644 --- a/backend/src/main/java/org/ftclub/cabinet/admin/item/service/AdminItemFacadeService.java +++ b/backend/src/main/java/org/ftclub/cabinet/admin/item/service/AdminItemFacadeService.java @@ -16,10 +16,8 @@ import org.ftclub.cabinet.item.service.ItemHistoryCommandService; import org.ftclub.cabinet.item.service.ItemHistoryQueryService; import org.ftclub.cabinet.item.service.ItemQueryService; -import org.ftclub.cabinet.item.service.ItemRedisService; import org.ftclub.cabinet.mapper.ItemMapper; import org.ftclub.cabinet.user.service.UserCommandService; -import org.ftclub.cabinet.user.service.UserQueryService; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; @@ -35,9 +33,7 @@ public class AdminItemFacadeService { private final ItemHistoryCommandService itemHistoryCommandService; private final ItemMapper itemMapper; - private final ItemRedisService itemRedisService; private final UserCommandService userCommandService; - private final UserQueryService userQueryService; @Transactional public void createItem(Integer Price, Sku sku, ItemType type) { @@ -51,16 +47,9 @@ public void assignItem(List userIds, Sku sku) { LocalDateTime now = null; if (price > 0) { now = LocalDateTime.now(); - userIds.forEach(userId -> { - long coinAmount = userQueryService.getUser(userId).getCoin(); - itemRedisService.saveCoinCount(userId, coinAmount + item.getPrice()); - - long totalCoinSupply = itemRedisService.getTotalCoinSupply(); - itemRedisService.saveTotalCoinSupply(totalCoinSupply + item.getPrice()); - userCommandService.updateCoinAmount(userId, price); - }); + userCommandService.addBulkCoin(userIds, price); } - itemHistoryCommandService.createItemHistories(userIds, item.getId(), now); + itemHistoryCommandService.createItemHistories(userIds, item.getId(), now, price); } @Transactional From 8266c4bead30a60076b19a711b442772206b37ff Mon Sep 17 00:00:00 2001 From: saewoo1 Date: Fri, 25 Oct 2024 16:43:56 +0900 Subject: [PATCH 11/25] =?UTF-8?q?REFACTOR:=20=EB=8F=99=EC=A0=84=EC=A4=8D?= =?UTF-8?q?=EA=B8=B0=20=EC=8B=9C=20ItemHistory=EC=97=90=20=EC=BD=94?= =?UTF-8?q?=EC=9D=B8=20=EC=A3=BC=EC=9A=B4=20=EC=96=91=20=EC=A0=80=EC=9E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ftclub/cabinet/item/service/ItemFacadeService.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/src/main/java/org/ftclub/cabinet/item/service/ItemFacadeService.java b/backend/src/main/java/org/ftclub/cabinet/item/service/ItemFacadeService.java index b6f0e5546..384977313 100644 --- a/backend/src/main/java/org/ftclub/cabinet/item/service/ItemFacadeService.java +++ b/backend/src/main/java/org/ftclub/cabinet/item/service/ItemFacadeService.java @@ -195,7 +195,8 @@ public CoinCollectionRewardResponseDto collectCoinAndIssueReward(Long userId) { // DB에 코인 저장 Item coinCollect = itemQueryService.getBySku(Sku.COIN_COLLECT); int reward = (int) (coinCollect.getPrice().longValue()); - itemHistoryCommandService.createCoinItemHistory(userId, coinCollect.getId()); + itemHistoryCommandService.createCoinItemHistory(userId, coinCollect.getId(), + coinCollect.getPrice()); // 출석 일자에 따른 랜덤 리워드 지급 Long coinCollectionCountInMonth = @@ -206,7 +207,8 @@ public CoinCollectionRewardResponseDto collectCoinAndIssueReward(Long userId) { Sku coinSku = itemPolicyService.getRewardSku(randomPercentage); Item coinReward = itemQueryService.getBySku(coinSku); - itemHistoryCommandService.createCoinItemHistory(userId, coinReward.getId()); + itemHistoryCommandService.createCoinItemHistory(userId, coinReward.getId(), + coinReward.getPrice()); reward += coinReward.getPrice(); } @@ -310,7 +312,7 @@ public void purchaseItem(Long userId, Sku sku) { itemPolicyService.verifyIsAffordable(userCoin, price); // 아이템 구매 처리 - itemHistoryCommandService.createItemHistory(user.getId(), item.getId()); + itemHistoryCommandService.createItemHistory(user.getId(), item.getId(), price); LockUtil.lockRedisCoin(userId, () -> { // 코인 차감 From 023563716069e21616416a1540b175bb2db6b3ad Mon Sep 17 00:00:00 2001 From: saewoo1 Date: Fri, 25 Oct 2024 16:44:29 +0900 Subject: [PATCH 12/25] =?UTF-8?q?REFACTOR:=20=EB=8F=99=EC=A0=84=EC=A4=8D?= =?UTF-8?q?=EA=B8=B0=20=EC=8B=9C=20ItemHistory=EC=97=90=20=EC=BD=94?= =?UTF-8?q?=EC=9D=B8=20=EC=A3=BC=EC=9A=B4=20=EC=96=91=20=EC=A0=80=EC=9E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cabinet/item/domain/ItemHistory.java | 21 +++---------------- .../user/service/LentExtensionManager.java | 3 ++- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/backend/src/main/java/org/ftclub/cabinet/item/domain/ItemHistory.java b/backend/src/main/java/org/ftclub/cabinet/item/domain/ItemHistory.java index 2dc9195a1..8f85c32c4 100644 --- a/backend/src/main/java/org/ftclub/cabinet/item/domain/ItemHistory.java +++ b/backend/src/main/java/org/ftclub/cabinet/item/domain/ItemHistory.java @@ -78,13 +78,7 @@ public class ItemHistory { @Column(name = "AMOUNT", nullable = true) private Long amount; - protected ItemHistory(long userId, long itemId, LocalDateTime usedAt) { - this.userId = userId; - this.itemId = itemId; - this.usedAt = usedAt; - } - - protected ItemHistory(long userId, long itemId, LocalDateTime assignedAt, Long amount) { + protected ItemHistory(Long userId, Long itemId, LocalDateTime assignedAt, Long amount) { this.userId = userId; this.itemId = itemId; this.usedAt = assignedAt; @@ -97,17 +91,8 @@ protected ItemHistory(long userId, long itemId, LocalDateTime assignedAt, Long a * @param usedAt 아이템 사용일자 * @return 아이템 히스토리 객체 {@link ItemHistory} */ - public static ItemHistory of(long userId, long itemId, LocalDateTime usedAt) { - ItemHistory itemHistory = new ItemHistory(userId, itemId, usedAt); - if (!itemHistory.isValid()) { - throw ExceptionStatus.INVALID_ARGUMENT.asDomainException(); - } - return itemHistory; - } - - public static ItemHistory coin(Long userId, Long itemId, LocalDateTime assignedAt, - Long amount) { - ItemHistory itemHistory = new ItemHistory(userId, itemId, assignedAt, amount); + public static ItemHistory of(Long userId, Long itemId, LocalDateTime usedAt, Long amount) { + ItemHistory itemHistory = new ItemHistory(userId, itemId, usedAt, amount); if (!itemHistory.isValid()) { throw ExceptionStatus.INVALID_ARGUMENT.asDomainException(); } diff --git a/backend/src/main/java/org/ftclub/cabinet/user/service/LentExtensionManager.java b/backend/src/main/java/org/ftclub/cabinet/user/service/LentExtensionManager.java index cb569e574..380efefc8 100644 --- a/backend/src/main/java/org/ftclub/cabinet/user/service/LentExtensionManager.java +++ b/backend/src/main/java/org/ftclub/cabinet/user/service/LentExtensionManager.java @@ -46,7 +46,8 @@ public void issueLentExtension() { users.forEach(user -> { Long userId = user.getId(); user.addCoin(coinRewardItem.getPrice()); - itemHistoryCommandService.createCoinItemHistory(userId, coinRewardItem.getId()); + itemHistoryCommandService.createCoinItemHistory(userId, coinRewardItem.getId(), + coinRewardItem.getPrice()); }); } From 94b93179f4e7396df38e855095acf94550b1e59e Mon Sep 17 00:00:00 2001 From: jnkeniaem Date: Fri, 25 Oct 2024 16:45:08 +0900 Subject: [PATCH 13/25] =?UTF-8?q?[FE]=20FEAT:=20=EC=95=84=EC=9D=B4?= =?UTF-8?q?=ED=85=9C=20=EC=A7=80=EA=B8=89=20=EB=AA=A8=EB=8B=AC=EC=97=90=20?= =?UTF-8?q?=EC=BD=94=EC=9D=B8=EB=9E=80=20=EC=B6=94=EA=B0=80=20#1695?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StoreModal/AdminItemProvisionModal.tsx | 45 +++++++++++++++++-- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/frontend/src/Cabinet/components/Modals/StoreModal/AdminItemProvisionModal.tsx b/frontend/src/Cabinet/components/Modals/StoreModal/AdminItemProvisionModal.tsx index 6b102b82e..89c8f616b 100644 --- a/frontend/src/Cabinet/components/Modals/StoreModal/AdminItemProvisionModal.tsx +++ b/frontend/src/Cabinet/components/Modals/StoreModal/AdminItemProvisionModal.tsx @@ -1,4 +1,4 @@ -import { useEffect, useState } from "react"; +import { useEffect, useRef, useState } from "react"; import { useRecoilState } from "recoil"; import styled from "styled-components"; import { targetUserInfoState } from "@/Cabinet/recoil/atoms"; @@ -14,7 +14,10 @@ import { } from "@/Cabinet/components/Modals/ResponseModal/ResponseModal"; import { IItemDetail } from "@/Cabinet/types/dto/store.dto"; import { StoreItemType } from "@/Cabinet/types/enum/store.enum"; -import { axiosItemAssign, axiosItems } from "@/Cabinet/api/axios/axios.custom"; +import { + axiosCoinAssign, // axiosItemAssign, + axiosItems, +} from "@/Cabinet/api/axios/axios.custom"; interface IPenaltyModalProps { onClose: () => void; @@ -35,11 +38,18 @@ const AdminItemProvisionModal: React.FC = ({ onClose }) => { const [isItemDropdownOpen, setIsItemDropdownOpen] = useState(false); const [isItemTypeDropdownOpen, setIsItemTypeDropdownOpen] = useState(false); const [targetUserInfo] = useRecoilState(targetUserInfoState); - + const coinRef = useRef(null); const HandleItemProvisionBtn = async () => { + let coinRefVal = coinRef.current!.value; + coinRefVal = coinRefVal == "" ? "0" : String(coinRefVal); setIsLoading(true); try { - await axiosItemAssign(selectedItemSku, [targetUserInfo.userId!]); + // await axiosItemAssign(selectedItemSku, [targetUserInfo.userId!]); + await axiosCoinAssign( + selectedItemSku, + [targetUserInfo.userId!], + Number(coinRefVal) + ); setModalTitle("아이템 지급완료"); } catch (error: any) { setHasErrorOnResponse(true); @@ -152,6 +162,18 @@ const AdminItemProvisionModal: React.FC = ({ onClose }) => { 아이템 타입 + + + 코인 + { + if (e.key === "Enter") HandleItemProvisionBtn(); + }} + ref={coinRef} + maxLength={10} + id="input" + > + ), }; @@ -179,4 +201,19 @@ const ModalDropdownNameStyled = styled.div` font-size: 18px; `; +const CoinInputStyled = styled.input` + border: 1px solid var(--light-gray-line-btn-color); + width: 100%; + height: 60px; + border-radius: 10px; + text-align: start; + text-indent: 20px; + font-size: 1.125rem; + cursor: "input"; + color: "var(--normal-text-color)"; + &::placeholder { + color: "var(--line-color)"; + } +`; + export default AdminItemProvisionModal; From 722aba42f965b5632408f15ff41b681613650e41 Mon Sep 17 00:00:00 2001 From: saewoo1 Date: Fri, 25 Oct 2024 16:46:05 +0900 Subject: [PATCH 14/25] =?UTF-8?q?REFACTOR:=20ItemHistory=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20=EC=8B=9C=20amount=20=ED=95=84=EC=88=98=20=ED=8C=8C?= =?UTF-8?q?=EB=9D=BC=EB=AF=B8=ED=84=B0=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../item/service/ItemHistoryCommandService.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/backend/src/main/java/org/ftclub/cabinet/item/service/ItemHistoryCommandService.java b/backend/src/main/java/org/ftclub/cabinet/item/service/ItemHistoryCommandService.java index 3319605d5..f76562608 100644 --- a/backend/src/main/java/org/ftclub/cabinet/item/service/ItemHistoryCommandService.java +++ b/backend/src/main/java/org/ftclub/cabinet/item/service/ItemHistoryCommandService.java @@ -17,20 +17,22 @@ public class ItemHistoryCommandService { private final ItemHistoryRepository itemHistoryRepository; - public void createItemHistory(Long userId, Long itemId) { - ItemHistory itemHistory = ItemHistory.of(userId, itemId, null); + public void createItemHistory(Long userId, Long itemId, Long amount) { + ItemHistory itemHistory = ItemHistory.of(userId, itemId, null, amount); itemHistoryRepository.save(itemHistory); } - public void createItemHistories(List userIds, Long itemId, LocalDateTime usedAt) { + public void createItemHistories(List userIds, Long itemId, LocalDateTime usedAt, + Long amount) { List itemHistories = userIds.stream() - .map(userId -> ItemHistory.of(userId, itemId, usedAt)) + .map(userId -> ItemHistory.of(userId, itemId, usedAt, amount)) .collect(Collectors.toList()); itemHistoryRepository.saveAll(itemHistories); } - public void createCoinItemHistory(Long userId, Long itemId) { - ItemHistory coinCollectItemHistory = ItemHistory.of(userId, itemId, LocalDateTime.now()); + public void createCoinItemHistory(Long userId, Long itemId, Long amount) { + ItemHistory coinCollectItemHistory = ItemHistory.of(userId, itemId, LocalDateTime.now(), + amount); itemHistoryRepository.save(coinCollectItemHistory); } @@ -45,7 +47,7 @@ public void createCoinItemHistory(Long userId, Long itemId) { public void createCoinAssignHistory(List userIds, Long itemId, LocalDateTime usedAt, Long amount) { List itemHistories = userIds.stream() - .map(userId -> ItemHistory.coin(userId, itemId, usedAt, amount)) + .map(userId -> ItemHistory.of(userId, itemId, usedAt, amount)) .collect(Collectors.toList()); itemHistoryRepository.saveAll(itemHistories); From 059d11b28be844b1cbd3b58b8712196d07d62a33 Mon Sep 17 00:00:00 2001 From: saewoo1 Date: Fri, 25 Oct 2024 17:11:20 +0900 Subject: [PATCH 15/25] =?UTF-8?q?FEAT:=20sku=EC=97=90=20=EC=BD=94=EC=9D=B8?= =?UTF-8?q?=20=EB=B3=B4=EC=83=81=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/main/java/org/ftclub/cabinet/item/domain/Sku.java | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/src/main/java/org/ftclub/cabinet/item/domain/Sku.java b/backend/src/main/java/org/ftclub/cabinet/item/domain/Sku.java index bda3b9beb..4e2d2b776 100644 --- a/backend/src/main/java/org/ftclub/cabinet/item/domain/Sku.java +++ b/backend/src/main/java/org/ftclub/cabinet/item/domain/Sku.java @@ -30,6 +30,7 @@ public enum Sku { ADMIN_REWARD_500("보상"), ADMIN_REWARD_1000("보상"), ADMIN_REWARD_2000("보상"), + ADMIN_REWARD_COIN("보상"), ; private final String details; From 307f533bd1d88a726992aec07b76a58d00246b5c Mon Sep 17 00:00:00 2001 From: saewoo1 Date: Fri, 25 Oct 2024 17:20:46 +0900 Subject: [PATCH 16/25] =?UTF-8?q?FEAT:=20admin=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EC=A7=80=EA=B8=89=ED=95=A0=20=EC=95=84=EC=9D=B4=ED=85=9C=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20=EA=B8=B0=EB=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../item/controller/AdminItemController.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/backend/src/main/java/org/ftclub/cabinet/admin/item/controller/AdminItemController.java b/backend/src/main/java/org/ftclub/cabinet/admin/item/controller/AdminItemController.java index 330134298..34805325d 100644 --- a/backend/src/main/java/org/ftclub/cabinet/admin/item/controller/AdminItemController.java +++ b/backend/src/main/java/org/ftclub/cabinet/admin/item/controller/AdminItemController.java @@ -1,5 +1,11 @@ package org.ftclub.cabinet.admin.item.controller; +import static java.util.stream.Collectors.groupingBy; +import static java.util.stream.Collectors.mapping; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; import lombok.RequiredArgsConstructor; import org.ftclub.cabinet.admin.dto.AdminCoinAssignRequestDto; import org.ftclub.cabinet.admin.dto.AdminItemHistoryPaginationDto; @@ -8,7 +14,14 @@ import org.ftclub.cabinet.auth.domain.AuthLevel; import org.ftclub.cabinet.dto.ItemAssignRequestDto; import org.ftclub.cabinet.dto.ItemCreateDto; +import org.ftclub.cabinet.dto.ItemDetailsDto; +import org.ftclub.cabinet.dto.ItemStoreDto; +import org.ftclub.cabinet.dto.ItemStoreResponseDto; +import org.ftclub.cabinet.item.domain.Item; +import org.ftclub.cabinet.item.domain.ItemType; +import org.ftclub.cabinet.item.service.ItemQueryService; import org.ftclub.cabinet.log.Logging; +import org.ftclub.cabinet.mapper.ItemMapper; import org.springframework.data.domain.Pageable; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -24,6 +37,8 @@ public class AdminItemController { private final AdminItemFacadeService adminItemFacadeService; + private final ItemQueryService itemQueryService; + private final ItemMapper itemMapper; @PostMapping("") @AuthGuard(level = AuthLevel.ADMIN_ONLY) @@ -32,6 +47,24 @@ public void createItem(@RequestBody ItemCreateDto itemCreateDto) { itemCreateDto.getSku(), itemCreateDto.getType()); } + @GetMapping("") + @AuthGuard(level = AuthLevel.ADMIN_ONLY) + public ItemStoreResponseDto getAllItems() { + List allItems = itemQueryService.getAllItems(); + Map> itemMap = allItems.stream() + .collect(groupingBy(Item::getType, + mapping(itemMapper::toItemDetailsDto, Collectors.toList()))); + List result = itemMap.entrySet().stream() + .map(entry -> { + ItemStoreDto itemStoreDto = itemMapper.toItemStoreDto(entry.getKey(), + entry.getValue()); + itemStoreDto.sortBySkuASC(); + return itemStoreDto; + }) + .collect(Collectors.toList()); + return new ItemStoreResponseDto(result); + } + @PostMapping("/assign") @AuthGuard(level = AuthLevel.ADMIN_ONLY) public void assignItem(@RequestBody ItemAssignRequestDto itemAssignRequestDto) { From 100e18087b08749573747b57b826d9881231ada0 Mon Sep 17 00:00:00 2001 From: saewoo1 Date: Fri, 25 Oct 2024 18:02:44 +0900 Subject: [PATCH 17/25] =?UTF-8?q?FIX=20:=20dto=20sku=20=EB=B3=80=EC=88=98?= =?UTF-8?q?=EB=AA=85=20=ED=86=B5=EC=9D=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/dto/AdminCoinAssignRequestDto.java | 2 +- .../admin/item/service/AdminItemFacadeService.java | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/backend/src/main/java/org/ftclub/cabinet/admin/dto/AdminCoinAssignRequestDto.java b/backend/src/main/java/org/ftclub/cabinet/admin/dto/AdminCoinAssignRequestDto.java index 764d225c9..beb456125 100644 --- a/backend/src/main/java/org/ftclub/cabinet/admin/dto/AdminCoinAssignRequestDto.java +++ b/backend/src/main/java/org/ftclub/cabinet/admin/dto/AdminCoinAssignRequestDto.java @@ -10,6 +10,6 @@ public class AdminCoinAssignRequestDto { private List userIds; - private Sku sku; + private Sku itemSku; private Long amount; } diff --git a/backend/src/main/java/org/ftclub/cabinet/admin/item/service/AdminItemFacadeService.java b/backend/src/main/java/org/ftclub/cabinet/admin/item/service/AdminItemFacadeService.java index 85dcabf86..29f86a8f1 100644 --- a/backend/src/main/java/org/ftclub/cabinet/admin/item/service/AdminItemFacadeService.java +++ b/backend/src/main/java/org/ftclub/cabinet/admin/item/service/AdminItemFacadeService.java @@ -55,9 +55,16 @@ public void assignItem(List userIds, Sku sku) { @Transactional public void assignCoin(List userIds, Sku sku, Long amount) { Item item = itemQueryService.getBySku(sku); - LocalDateTime now = LocalDateTime.now(); - userCommandService.addBulkCoin(userIds, amount); - itemHistoryCommandService.createCoinAssignHistory(userIds, item.getId(), now, amount); + LocalDateTime now = null; + Long coinAmount = item.getPrice(); + if (sku.equals(Sku.ADMIN_REWARD_COIN)) { + coinAmount = amount; + } + if (coinAmount > 0) { + now = LocalDateTime.now(); + userCommandService.addBulkCoin(userIds, coinAmount); + } + itemHistoryCommandService.createItemHistories(userIds, item.getId(), now, coinAmount); } @Transactional(readOnly = true) From d3ec7825100f3953c606daf54e58ab3169531f9e Mon Sep 17 00:00:00 2001 From: saewoo1 Date: Fri, 25 Oct 2024 18:03:01 +0900 Subject: [PATCH 18/25] =?UTF-8?q?FIX=20:=20dto=20sku=20=EB=B3=80=EC=88=98?= =?UTF-8?q?=EB=AA=85=20=ED=86=B5=EC=9D=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cabinet/admin/item/controller/AdminItemController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/main/java/org/ftclub/cabinet/admin/item/controller/AdminItemController.java b/backend/src/main/java/org/ftclub/cabinet/admin/item/controller/AdminItemController.java index 34805325d..95cbb1a30 100644 --- a/backend/src/main/java/org/ftclub/cabinet/admin/item/controller/AdminItemController.java +++ b/backend/src/main/java/org/ftclub/cabinet/admin/item/controller/AdminItemController.java @@ -76,7 +76,7 @@ public void assignItem(@RequestBody ItemAssignRequestDto itemAssignRequestDto) { @AuthGuard(level = AuthLevel.ADMIN_ONLY) public void assignCoin(@RequestBody AdminCoinAssignRequestDto coinAssignRequestDto) { adminItemFacadeService.assignCoin(coinAssignRequestDto.getUserIds(), - coinAssignRequestDto.getSku(), coinAssignRequestDto.getAmount()); + coinAssignRequestDto.getItemSku(), coinAssignRequestDto.getAmount()); } /** From 1615ff96415ae989acb26f7ffa0abb4712ae5182 Mon Sep 17 00:00:00 2001 From: saewoo1 Date: Fri, 25 Oct 2024 18:28:43 +0900 Subject: [PATCH 19/25] =?UTF-8?q?FEAT:=20=EA=B4=80=EB=A6=AC=EC=9E=90=20?= =?UTF-8?q?=EA=B3=84=EC=A0=95=EC=97=90=EC=84=9C=20=EC=BD=94=EC=9D=B8=20?= =?UTF-8?q?=EC=A7=80=EA=B8=89=20=EC=8B=9C=20=EC=BD=94=EC=9D=B8=EC=9D=B4=20?= =?UTF-8?q?=EB=B9=84=EC=96=B4=EC=9E=88=EC=9D=84=20=EA=B2=BD=EC=9A=B0=20?= =?UTF-8?q?=EC=98=88=EC=99=B8=20=EB=B0=98=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/ftclub/cabinet/exception/ExceptionStatus.java | 3 ++- .../org/ftclub/cabinet/item/service/ItemPolicyService.java | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/backend/src/main/java/org/ftclub/cabinet/exception/ExceptionStatus.java b/backend/src/main/java/org/ftclub/cabinet/exception/ExceptionStatus.java index 39c570da2..f5047d2c3 100644 --- a/backend/src/main/java/org/ftclub/cabinet/exception/ExceptionStatus.java +++ b/backend/src/main/java/org/ftclub/cabinet/exception/ExceptionStatus.java @@ -84,7 +84,8 @@ public enum ExceptionStatus { INVALID_JWT_TOKEN(HttpStatus.BAD_REQUEST, "토큰이 없거나, 유효하지 않은 JWT 토큰입니다."), NOT_FOUND_SECTION(HttpStatus.BAD_REQUEST, "사물함 구역 정보를 찾을 수 없습니다."), ITEM_NOT_OWNED(HttpStatus.BAD_REQUEST, "해당 아이템을 보유하고 있지 않습니다"), - ITEM_USE_DUPLICATED(HttpStatus.FORBIDDEN, "아이템이 중복 사용되었습니다."); + ITEM_USE_DUPLICATED(HttpStatus.FORBIDDEN, "아이템이 중복 사용되었습니다."), + INVALID_AMOUNT(HttpStatus.BAD_REQUEST, "코인 지급양은 비어있을 수 없습니다."); final private int statusCode; final private String message; diff --git a/backend/src/main/java/org/ftclub/cabinet/item/service/ItemPolicyService.java b/backend/src/main/java/org/ftclub/cabinet/item/service/ItemPolicyService.java index f27d4bf75..49c7dd4e3 100644 --- a/backend/src/main/java/org/ftclub/cabinet/item/service/ItemPolicyService.java +++ b/backend/src/main/java/org/ftclub/cabinet/item/service/ItemPolicyService.java @@ -64,4 +64,10 @@ public Sku getRewardSku(int randomPercentage) { return Sku.COIN_REWARD_2000; } } + + public void verifyCoinAmount(Long amount) { + if (amount == null) { + throw ExceptionStatus.INVALID_AMOUNT.asServiceException(); + } + } } From 2fad20589ca0ef7bd1fb92bf15bc69ea4134f522 Mon Sep 17 00:00:00 2001 From: saewoo1 Date: Fri, 25 Oct 2024 18:29:39 +0900 Subject: [PATCH 20/25] =?UTF-8?q?REFACTOR:=20=EC=BD=94=EC=9D=B8=20?= =?UTF-8?q?=EB=82=B4=EC=97=AD=20=EC=A1=B0=ED=9A=8C=20=EC=8B=9C=20itemHisto?= =?UTF-8?q?ry=EC=9D=98=20amount=EB=A5=BC=20=EC=A1=B0=ED=9A=8C=ED=95=98?= =?UTF-8?q?=EC=97=AC=20=EB=B0=98=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cabinet/admin/item/service/AdminItemFacadeService.java | 3 +++ .../src/main/java/org/ftclub/cabinet/dto/CoinHistoryDto.java | 2 +- .../src/main/java/org/ftclub/cabinet/mapper/ItemMapper.java | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/src/main/java/org/ftclub/cabinet/admin/item/service/AdminItemFacadeService.java b/backend/src/main/java/org/ftclub/cabinet/admin/item/service/AdminItemFacadeService.java index 29f86a8f1..601bdafe4 100644 --- a/backend/src/main/java/org/ftclub/cabinet/admin/item/service/AdminItemFacadeService.java +++ b/backend/src/main/java/org/ftclub/cabinet/admin/item/service/AdminItemFacadeService.java @@ -15,6 +15,7 @@ import org.ftclub.cabinet.item.service.ItemCommandService; import org.ftclub.cabinet.item.service.ItemHistoryCommandService; import org.ftclub.cabinet.item.service.ItemHistoryQueryService; +import org.ftclub.cabinet.item.service.ItemPolicyService; import org.ftclub.cabinet.item.service.ItemQueryService; import org.ftclub.cabinet.mapper.ItemMapper; import org.ftclub.cabinet.user.service.UserCommandService; @@ -31,6 +32,7 @@ public class AdminItemFacadeService { private final ItemCommandService itemCommandService; private final ItemHistoryQueryService itemHistoryQueryService; private final ItemHistoryCommandService itemHistoryCommandService; + private final ItemPolicyService itemPolicyService; private final ItemMapper itemMapper; private final UserCommandService userCommandService; @@ -58,6 +60,7 @@ public void assignCoin(List userIds, Sku sku, Long amount) { LocalDateTime now = null; Long coinAmount = item.getPrice(); if (sku.equals(Sku.ADMIN_REWARD_COIN)) { + itemPolicyService.verifyCoinAmount(amount); coinAmount = amount; } if (coinAmount > 0) { diff --git a/backend/src/main/java/org/ftclub/cabinet/dto/CoinHistoryDto.java b/backend/src/main/java/org/ftclub/cabinet/dto/CoinHistoryDto.java index 023469920..ef2b1afa3 100644 --- a/backend/src/main/java/org/ftclub/cabinet/dto/CoinHistoryDto.java +++ b/backend/src/main/java/org/ftclub/cabinet/dto/CoinHistoryDto.java @@ -13,7 +13,7 @@ public class CoinHistoryDto { private LocalDateTime date; - private Integer amount; + private Long amount; private String history; private String itemDetails; } diff --git a/backend/src/main/java/org/ftclub/cabinet/mapper/ItemMapper.java b/backend/src/main/java/org/ftclub/cabinet/mapper/ItemMapper.java index 71939ee98..ed7d19f36 100644 --- a/backend/src/main/java/org/ftclub/cabinet/mapper/ItemMapper.java +++ b/backend/src/main/java/org/ftclub/cabinet/mapper/ItemMapper.java @@ -40,6 +40,7 @@ public interface ItemMapper { @Mapping(target = "amount", source = "item.price") @Mapping(target = "history", source = "item.type.name") @Mapping(target = "itemDetails", source = "item.sku.details") + @Mapping(target = "amount", source = "itemHistory.amount") CoinHistoryDto toCoinHistoryDto(ItemHistory itemHistory, Item item); @Mapping(target = "itemSku", source = "item.sku") From 5aabdaad7f4f088bbd25d582a864233902048fbd Mon Sep 17 00:00:00 2001 From: saewoo1 Date: Fri, 25 Oct 2024 18:37:20 +0900 Subject: [PATCH 21/25] =?UTF-8?q?REFACTOR:=20Sku=EC=97=90=20=EB=AA=85?= =?UTF-8?q?=ED=99=95=ED=95=9C=20=EB=B3=B4=EC=83=81=20=EB=82=B4=EC=97=AD=20?= =?UTF-8?q?=EB=AA=85=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/ftclub/cabinet/item/domain/Sku.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/src/main/java/org/ftclub/cabinet/item/domain/Sku.java b/backend/src/main/java/org/ftclub/cabinet/item/domain/Sku.java index 4e2d2b776..64b383a7a 100644 --- a/backend/src/main/java/org/ftclub/cabinet/item/domain/Sku.java +++ b/backend/src/main/java/org/ftclub/cabinet/item/domain/Sku.java @@ -25,12 +25,12 @@ public enum Sku { COIN_REWARD_1000("동전 줍기 20일 보상"), COIN_REWARD_2000("동전 줍기 20일 보상"), - ADMIN_REWARD_100("보상"), - ADMIN_REWARD_200("보상"), - ADMIN_REWARD_500("보상"), - ADMIN_REWARD_1000("보상"), - ADMIN_REWARD_2000("보상"), - ADMIN_REWARD_COIN("보상"), + ADMIN_REWARD_100("100"), + ADMIN_REWARD_200("200"), + ADMIN_REWARD_500("500"), + ADMIN_REWARD_1000("1000"), + ADMIN_REWARD_2000("2000"), + ADMIN_REWARD_COIN("지정 보상"), ; private final String details; From 43ba5742e72362772dd65061f0425ccd032131a6 Mon Sep 17 00:00:00 2001 From: chyo1 Date: Fri, 25 Oct 2024 18:41:13 +0900 Subject: [PATCH 22/25] =?UTF-8?q?[BE]=20FIX:=20itemHistory=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EC=95=84=EC=9D=B4=ED=85=9C=20=EA=B0=80=EA=B2=A9=20?= =?UTF-8?q?amount=EC=97=90=EC=84=9C=20=EB=B0=9B=EC=95=84=EC=98=A4=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/main/java/org/ftclub/cabinet/mapper/ItemMapper.java | 1 - 1 file changed, 1 deletion(-) diff --git a/backend/src/main/java/org/ftclub/cabinet/mapper/ItemMapper.java b/backend/src/main/java/org/ftclub/cabinet/mapper/ItemMapper.java index ed7d19f36..2649d97d4 100644 --- a/backend/src/main/java/org/ftclub/cabinet/mapper/ItemMapper.java +++ b/backend/src/main/java/org/ftclub/cabinet/mapper/ItemMapper.java @@ -37,7 +37,6 @@ public interface ItemMapper { ItemMapper INSTANCE = Mappers.getMapper(ItemMapper.class); @Mapping(target = "date", source = "itemHistory.purchaseAt") - @Mapping(target = "amount", source = "item.price") @Mapping(target = "history", source = "item.type.name") @Mapping(target = "itemDetails", source = "item.sku.details") @Mapping(target = "amount", source = "itemHistory.amount") From 800a8a5e4ab2d9cb4a9bb009bfbd70a6255c348c Mon Sep 17 00:00:00 2001 From: saewoo1 Date: Fri, 25 Oct 2024 18:46:52 +0900 Subject: [PATCH 23/25] =?UTF-8?q?REFACTOR:=20=EA=B4=80=EB=A6=AC=EC=9E=90?= =?UTF-8?q?=20=EA=B3=84=EC=A0=95=EC=97=90=EC=84=9C=20=EC=95=84=EC=9D=B4?= =?UTF-8?q?=ED=85=9C,=20=EC=BD=94=EC=9D=B8=20=EC=A7=80=EA=B8=89=20?= =?UTF-8?q?=EC=BB=A8=ED=8A=B8=EB=A1=A4=EB=9F=AC=20=ED=86=B5=ED=95=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/item/controller/AdminItemController.java | 10 +--------- .../admin/item/service/AdminItemFacadeService.java | 14 +------------- .../ftclub/cabinet/dto/ItemAssignRequestDto.java | 1 + 3 files changed, 3 insertions(+), 22 deletions(-) diff --git a/backend/src/main/java/org/ftclub/cabinet/admin/item/controller/AdminItemController.java b/backend/src/main/java/org/ftclub/cabinet/admin/item/controller/AdminItemController.java index 95cbb1a30..46035ef85 100644 --- a/backend/src/main/java/org/ftclub/cabinet/admin/item/controller/AdminItemController.java +++ b/backend/src/main/java/org/ftclub/cabinet/admin/item/controller/AdminItemController.java @@ -7,7 +7,6 @@ import java.util.Map; import java.util.stream.Collectors; import lombok.RequiredArgsConstructor; -import org.ftclub.cabinet.admin.dto.AdminCoinAssignRequestDto; import org.ftclub.cabinet.admin.dto.AdminItemHistoryPaginationDto; import org.ftclub.cabinet.admin.item.service.AdminItemFacadeService; import org.ftclub.cabinet.auth.domain.AuthGuard; @@ -69,14 +68,7 @@ public ItemStoreResponseDto getAllItems() { @AuthGuard(level = AuthLevel.ADMIN_ONLY) public void assignItem(@RequestBody ItemAssignRequestDto itemAssignRequestDto) { adminItemFacadeService.assignItem(itemAssignRequestDto.getUserIds(), - itemAssignRequestDto.getItemSku()); - } - - @PostMapping("/assign/coin") - @AuthGuard(level = AuthLevel.ADMIN_ONLY) - public void assignCoin(@RequestBody AdminCoinAssignRequestDto coinAssignRequestDto) { - adminItemFacadeService.assignCoin(coinAssignRequestDto.getUserIds(), - coinAssignRequestDto.getItemSku(), coinAssignRequestDto.getAmount()); + itemAssignRequestDto.getItemSku(), itemAssignRequestDto.getAmount()); } /** diff --git a/backend/src/main/java/org/ftclub/cabinet/admin/item/service/AdminItemFacadeService.java b/backend/src/main/java/org/ftclub/cabinet/admin/item/service/AdminItemFacadeService.java index 601bdafe4..dda0e8fed 100644 --- a/backend/src/main/java/org/ftclub/cabinet/admin/item/service/AdminItemFacadeService.java +++ b/backend/src/main/java/org/ftclub/cabinet/admin/item/service/AdminItemFacadeService.java @@ -43,19 +43,7 @@ public void createItem(Integer Price, Sku sku, ItemType type) { } @Transactional - public void assignItem(List userIds, Sku sku) { - Item item = itemQueryService.getBySku(sku); - Long price = item.getPrice(); - LocalDateTime now = null; - if (price > 0) { - now = LocalDateTime.now(); - userCommandService.addBulkCoin(userIds, price); - } - itemHistoryCommandService.createItemHistories(userIds, item.getId(), now, price); - } - - @Transactional - public void assignCoin(List userIds, Sku sku, Long amount) { + public void assignItem(List userIds, Sku sku, Long amount) { Item item = itemQueryService.getBySku(sku); LocalDateTime now = null; Long coinAmount = item.getPrice(); diff --git a/backend/src/main/java/org/ftclub/cabinet/dto/ItemAssignRequestDto.java b/backend/src/main/java/org/ftclub/cabinet/dto/ItemAssignRequestDto.java index 20770c617..e8708378f 100644 --- a/backend/src/main/java/org/ftclub/cabinet/dto/ItemAssignRequestDto.java +++ b/backend/src/main/java/org/ftclub/cabinet/dto/ItemAssignRequestDto.java @@ -15,4 +15,5 @@ public class ItemAssignRequestDto { private Sku itemSku; private List userIds; + private Long amount; } From 04706a576596972293cd027360e6f0c1ba18e2a9 Mon Sep 17 00:00:00 2001 From: saewoo1 Date: Fri, 25 Oct 2024 19:04:26 +0900 Subject: [PATCH 24/25] =?UTF-8?q?FIX:=20=EC=A7=80=EA=B8=89=20=EC=BD=94?= =?UTF-8?q?=EC=9D=B8=20=EA=B0=80=EA=B2=A9=2010=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/database/cabi_local.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/database/cabi_local.sql b/backend/database/cabi_local.sql index 3e5fbea6f..cf1645be0 100644 --- a/backend/database/cabi_local.sql +++ b/backend/database/cabi_local.sql @@ -743,7 +743,7 @@ VALUES (1, 0, 'EXTENSION_PREV', 'EXTENSION'), (18, 500, 'ADMIN_REWARD_500', 'ADMIN_REWARD'), (19, 1000, 'ADMIN_REWARD_1000', 'ADMIN_REWARD'), (20, 2000, 'ADMIN_REWARD_2000', 'ADMIN_REWARD'), - (21, 0, 'ADMIN_REWARD_COIN', 'ADMIN_REWARD'); + (21, 10, 'ADMIN_REWARD_COIN', 'ADMIN_REWARD'); /*!40000 ALTER TABLE `item` ENABLE KEYS */; UNLOCK TABLES; From 6be179e2dff80a3cddfd427071d187a4308ef150 Mon Sep 17 00:00:00 2001 From: seonmiki Date: Fri, 25 Oct 2024 19:08:01 +0900 Subject: [PATCH 25/25] =?UTF-8?q?[FE]=20FEAT:=20=EC=9C=A0=EC=A0=80=20?= =?UTF-8?q?=EC=95=84=EC=9D=B4=ED=85=9C=20=EC=A7=80=EA=B8=89=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84=20#1695?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/Cabinet/api/axios/axios.custom.ts | 26 +++++++++++++++--- .../StoreModal/AdminItemProvisionModal.tsx | 27 ++++++++++--------- 2 files changed, 36 insertions(+), 17 deletions(-) diff --git a/frontend/src/Cabinet/api/axios/axios.custom.ts b/frontend/src/Cabinet/api/axios/axios.custom.ts index 8ff595ce2..620d3f275 100644 --- a/frontend/src/Cabinet/api/axios/axios.custom.ts +++ b/frontend/src/Cabinet/api/axios/axios.custom.ts @@ -371,6 +371,23 @@ export const axiosItems = async (): Promise => { const response = await instance.get(axiosItemsURL); return response; } catch (error) { + console.log(error); + logAxiosError( + error, + ErrorType.STORE, + "상점 아이템 목록 불러오는중 오류 발생" + ); + throw error; + } +}; + +const axiosAdminItemsURL = "/v5/admin/items"; +export const axiosAdminItems = async (): Promise => { + try { + const response = await instance.get(axiosAdminItemsURL); + return response; + } catch (error) { + console.log(error); logAxiosError( error, ErrorType.STORE, @@ -743,9 +760,9 @@ export const axiosLentClubCabinet = async ( try { const response = await instance.post( axiosLentClubCabinetURL + - clubId.toString() + - "/cabinets/" + - cabinetId.toString() + clubId.toString() + + "/cabinets/" + + cabinetId.toString() ); return response; } catch (error) { @@ -905,6 +922,7 @@ export const axiosSendSlackNotificationToChannel = async ( } }; +// TODO: 확인하고 필요없으면 지우기 const axiosItemAssignURL = "v5/admin/items/assign"; export const axiosItemAssign = async ( itemSku: string, @@ -922,7 +940,7 @@ export const axiosItemAssign = async ( } }; -const axiosCoinAssignURL = "v5/admin/items/assign/coin"; +const axiosCoinAssignURL = "v5/admin/items/assign"; export const axiosCoinAssign = async ( itemSku: string, userIds: number[], diff --git a/frontend/src/Cabinet/components/Modals/StoreModal/AdminItemProvisionModal.tsx b/frontend/src/Cabinet/components/Modals/StoreModal/AdminItemProvisionModal.tsx index 89c8f616b..80f809c8e 100644 --- a/frontend/src/Cabinet/components/Modals/StoreModal/AdminItemProvisionModal.tsx +++ b/frontend/src/Cabinet/components/Modals/StoreModal/AdminItemProvisionModal.tsx @@ -15,8 +15,8 @@ import { import { IItemDetail } from "@/Cabinet/types/dto/store.dto"; import { StoreItemType } from "@/Cabinet/types/enum/store.enum"; import { - axiosCoinAssign, // axiosItemAssign, - axiosItems, + axiosCoinAssign, + axiosAdminItems, } from "@/Cabinet/api/axios/axios.custom"; interface IPenaltyModalProps { @@ -44,7 +44,6 @@ const AdminItemProvisionModal: React.FC = ({ onClose }) => { coinRefVal = coinRefVal == "" ? "0" : String(coinRefVal); setIsLoading(true); try { - // await axiosItemAssign(selectedItemSku, [targetUserInfo.userId!]); await axiosCoinAssign( selectedItemSku, [targetUserInfo.userId!], @@ -53,7 +52,7 @@ const AdminItemProvisionModal: React.FC = ({ onClose }) => { setModalTitle("아이템 지급완료"); } catch (error: any) { setHasErrorOnResponse(true); - if (error.response.ststus === 400) setModalTitle("아이템 지급실패"); + if (error.response.status === 400) setModalTitle("아이템 지급실패"); else error.response ? setModalTitle(error.response.data.message) @@ -82,7 +81,7 @@ const AdminItemProvisionModal: React.FC = ({ onClose }) => { const getItems = async () => { try { - const response = await axiosItems(); + const response = await axiosAdminItems(); setItems(response.data.items); } catch (error) { throw error; @@ -126,17 +125,19 @@ const AdminItemProvisionModal: React.FC = ({ onClose }) => { }, []); const getItemTypeOptions = (item: IItemDetail) => { + console.log(item.items); + return item.items.length === 1 ? [ - { - name: "타입이 없습니다", - value: item.items[0].itemSku, - hasNoOptions: true, - }, - ] + { + name: "타입이 없습니다", + value: item.items[0].itemSku, + hasNoOptions: true, + }, + ] : item.items.map((item) => { - return { name: item.itemDetails, value: item.itemSku }; - }); + return { name: item.itemDetails, value: item.itemSku }; + }); }; const modalContents: IModalContents = {