From fa290b64ecb78af2258a9f2215362eed1501890f Mon Sep 17 00:00:00 2001 From: bcjang Date: Thu, 1 May 2025 07:04:14 +0900 Subject: [PATCH] =?UTF-8?q?api=20=EA=B3=B5=ED=86=B5=20=EB=AA=A8=EB=93=88?= =?UTF-8?q?=EC=83=9D=EC=84=B1=20search,=20api=20=EA=B3=B5=ED=86=B5=20?= =?UTF-8?q?=EB=AA=A8=EB=93=88=20=EC=83=9D=EC=84=B1=20=EA=B3=B5=ED=86=B5?= =?UTF-8?q?=EB=AA=A8=EB=93=88=20=ED=99=94=EB=A9=B4=20=EB=B3=84=20=EB=B0=98?= =?UTF-8?q?=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/RouteInfo.js | 5 +- src/apis/Item.js | 35 +- src/apis/index.js | 23 +- src/assets/data/apis/index.js | 7 + src/assets/data/apis/itemAPI.json | 17 + src/assets/data/apis/menuBannerAPI.json | 48 ++ src/assets/data/apis/sampleAPI.json | 131 +++++ src/assets/data/menuConfig.js | 20 +- src/assets/data/options.js | 169 +++--- src/assets/data/pages/itemSearch.json | 39 ++ src/assets/data/pages/itemTable.json | 90 +++ src/assets/data/pages/menuBannerSearch.json | 15 +- src/assets/data/pages/userBlockSearch.json | 2 +- src/components/DataManage/UserAvatarInfo.js | 4 +- src/components/DataManage/UserDefaultInfo.js | 96 ++-- src/components/DataManage/UserDressInfo.js | 4 +- src/components/DataManage/UserFriendInfo.js | 4 +- .../DataManage/UserInventoryInfo.js | 25 +- src/components/DataManage/UserMailInfo.js | 8 +- src/components/DataManage/UserMyHomeInfo.js | 4 +- src/components/DataManage/UserQuestInfo.js | 4 +- src/components/DataManage/UserTattooInfo.js | 4 +- src/components/DataManage/UserToolInfo.js | 4 +- .../ServiceManage/ImageUploadBtn.js | 261 +++++++++ src/components/ServiceManage/index.js | 6 +- .../ServiceManage/modal/MenuBannerModal.js | 473 ++++++++++++++++ .../searchBar/CommonSearchBar.js | 22 +- .../ServiceManage/searchBar/SearchFilter.js | 36 +- src/components/common/Custom/CaliForm.js | 526 ++++++++++++++++++ src/components/common/Custom/CaliTable.js | 9 +- .../common/SearchBar/SearchBarLayout.js | 45 +- src/components/common/Table/TableHeader.js | 11 +- src/components/common/Table/ViewTableInfo.js | 21 +- src/components/common/modal/DynamicModal.js | 4 +- src/context/AlertProvider.js | 10 +- src/hooks/useCommonSearch.js | 227 ++++++++ .../useCommonSearchOld.js} | 13 +- src/hooks/useDynamoDBPagination.js | 190 +++++++ src/hooks/useEnhancedCommonSearch.js | 118 ++++ src/hooks/useRDSPagination.js | 129 +++++ src/i18n.js | 9 +- src/pages/ServiceManage/Event.js | 3 +- src/pages/ServiceManage/Items.js | 399 ++++++------- src/pages/ServiceManage/Mail.js | 3 +- src/pages/ServiceManage/MenuBanner.js | 225 +++----- src/pages/ServiceManage/MenuBannerRegist.js | 125 ++--- src/pages/ServiceManage/UserBlock.js | 7 +- src/pages/ServiceManage/index.js | 1 - src/pages/UserManage/CaliumRequest.js | 3 +- src/styles/Components.js | 56 ++ src/utils/apiService.js | 135 +++++ src/utils/common.js | 20 + 52 files changed, 3171 insertions(+), 674 deletions(-) create mode 100644 src/assets/data/apis/index.js create mode 100644 src/assets/data/apis/itemAPI.json create mode 100644 src/assets/data/apis/menuBannerAPI.json create mode 100644 src/assets/data/apis/sampleAPI.json create mode 100644 src/assets/data/pages/itemSearch.json create mode 100644 src/assets/data/pages/itemTable.json create mode 100644 src/components/ServiceManage/ImageUploadBtn.js create mode 100644 src/components/ServiceManage/modal/MenuBannerModal.js create mode 100644 src/components/common/Custom/CaliForm.js create mode 100644 src/hooks/useCommonSearch.js rename src/{components/ServiceManage/searchBar/useCommonSearch.js => hooks/useCommonSearchOld.js} (93%) create mode 100644 src/hooks/useDynamoDBPagination.js create mode 100644 src/hooks/useEnhancedCommonSearch.js create mode 100644 src/hooks/useRDSPagination.js create mode 100644 src/utils/apiService.js diff --git a/src/RouteInfo.js b/src/RouteInfo.js index d6f7035..3bdcf37 100644 --- a/src/RouteInfo.js +++ b/src/RouteInfo.js @@ -24,9 +24,9 @@ import { ReportList, UserBlock, UserBlockRegist, - WhiteList, LandAuction, - BattleEvent, MenuBanner, MenuBannerRegist, + BattleEvent, + MenuBanner, MenuBannerRegist, } from './pages/ServiceManage'; const RouteInfo = () => { @@ -64,7 +64,6 @@ const RouteInfo = () => { } /> - } /> } /> } /> } /> diff --git a/src/apis/Item.js b/src/apis/Item.js index 7b5933c..4dd920a 100644 --- a/src/apis/Item.js +++ b/src/apis/Item.js @@ -2,26 +2,31 @@ import { Axios } from '../utils'; -//아이템 리스트 조회 -export const ItemListView = async (token, searchType, data, status, restore, order, size, currentPage) => { +export const ItemListAPI = async (token, params) => { try { - const res = await Axios.get( - `/api/v1/items/list?search_type=${searchType ? searchType : ''} - &search_key=${data ? data : ''} - &orderby=${order} - &page_no=${currentPage} - &page_size=${size} - `, - { - headers: { Authorization: `Bearer ${token}` }, - }, - ); - // console.log(res.data.data); + const res = await Axios.post(`/api/v1/items/list`, params, { + headers: { Authorization: `Bearer ${token}` }, + }); return res.data.data; } catch (e) { if (e instanceof Error) { - + throw new Error('ItemAPI Error', e); + } + } +}; + +export const ItemDeleteAPI = async (token, params) => { + try { + const res = await Axios.delete(`/api/v1/items/delete`, { + headers: { Authorization: `Bearer ${token}` }, + data: params, + }); + + return res.data; + } catch (e) { + if (e instanceof Error) { + throw new Error('ItemDelete Error', e); } } }; \ No newline at end of file diff --git a/src/apis/index.js b/src/apis/index.js index 5997932..976da98 100644 --- a/src/apis/index.js +++ b/src/apis/index.js @@ -1,10 +1,13 @@ +import { createAPIModule } from '../utils/apiService'; + +import * as APIConfigs from '../assets/data/apis' + export * from './Admin'; export * from './Auth'; export * from './Group'; export * from './History'; export * from './Mail'; export * from './Notice'; -export * from './WhiteList'; export * from './BlackList'; export * from './Users'; export * from './Indicators'; @@ -14,3 +17,21 @@ export * from './Calium'; export * from './Land'; export * from './Menu'; export * from './OpenAI'; + +const apiModules = {}; +const allApis = {}; + +// 각 API 설정에 대해 모듈 생성 +Object.entries(APIConfigs).forEach(([configName, config]) => { + const moduleName = configName.replace(/API$/, ''); // "userAPI" -> "user" + apiModules[moduleName] = createAPIModule(config); + + // 모든 API 함수 추출해서 allApis에 복사 + Object.entries(apiModules[moduleName]).forEach(([fnName, fn]) => { + allApis[fnName] = fn; + }); +}); + +export const Modules = apiModules; + +// export const ItemAPI = createAPIModule(itemAPIConfig); \ No newline at end of file diff --git a/src/assets/data/apis/index.js b/src/assets/data/apis/index.js new file mode 100644 index 0000000..0392a61 --- /dev/null +++ b/src/assets/data/apis/index.js @@ -0,0 +1,7 @@ +import itemAPI from './itemAPI.json'; +import menuBannerAPI from './menuBannerAPI.json'; + +export { + itemAPI, + menuBannerAPI +}; \ No newline at end of file diff --git a/src/assets/data/apis/itemAPI.json b/src/assets/data/apis/itemAPI.json new file mode 100644 index 0000000..30cecfd --- /dev/null +++ b/src/assets/data/apis/itemAPI.json @@ -0,0 +1,17 @@ +{ + "baseUrl": "/api/v1/items", + "endpoints": { + "ItemList": { + "method": "POST", + "url": "/list", + "dataPath": "data", + "paramFormat": "body" + }, + "ItemDelete": { + "method": "DELETE", + "url": "/delete", + "dataPath": "data", + "paramFormat": "body" + } + } +} \ No newline at end of file diff --git a/src/assets/data/apis/menuBannerAPI.json b/src/assets/data/apis/menuBannerAPI.json new file mode 100644 index 0000000..ea0f05b --- /dev/null +++ b/src/assets/data/apis/menuBannerAPI.json @@ -0,0 +1,48 @@ +{ + "baseUrl": "/api/v1/menu", + "endpoints": { + "MenuBannerView": { + "method": "GET", + "url": "/banner/list", + "dataPath": "data.data", + "paramFormat": "query" + }, + "MenuBannerDetailView": { + "method": "GET", + "url": "/banner/detail/:id", + "dataPath": "data.data", + "paramFormat": "query", + "paramMapping": ["id"] + }, + "MenuBannerSingleRegist": { + "method": "POST", + "url": "/banner", + "dataPath": "data", + "paramFormat": "body" + }, + "MenuBannerModify": { + "method": "PUT", + "url": "/banner/:id", + "dataPath": "data", + "paramFormat": "body" + }, + "MenuBannerDelete": { + "method": "DELETE", + "url": "/banner/delete", + "dataPath": "data", + "paramFormat": "body" + }, + "MenuImageUpload": { + "method": "POST", + "url": "/image-upload", + "dataPath": "data", + "paramFormat": "body" + }, + "MenuImageDelete": { + "method": "DELETE", + "url": "/image-delete", + "dataPath": "data", + "paramFormat": "body" + } + } +} \ No newline at end of file diff --git a/src/assets/data/apis/sampleAPI.json b/src/assets/data/apis/sampleAPI.json new file mode 100644 index 0000000..8e092f3 --- /dev/null +++ b/src/assets/data/apis/sampleAPI.json @@ -0,0 +1,131 @@ +{ + "baseUrl": "/api/v1/users", + "endpoints": { + "UserView": { + "method": "GET", + "url": "/api/v1/users/find-users", + "dataPath": "data.data.result", + "paramFormat": "query", + "paramMapping": ["search_type", "search_key"] + }, + "UserInfoView": { + "method": "GET", + "url": "/api/v1/users/basicinfo", + "dataPath": "data.data", + "paramFormat": "query", + "paramMapping": ["guid"] + }, + "UserChangeNickName": { + "method": "PUT", + "url": "/api/v1/users/change-nickname", + "dataPath": null, + "paramFormat": "body", + "paramMapping": ["guid", "nickname"] + }, + "UserChangeAdminLevel": { + "method": "PUT", + "url": "/api/v1/users/change-level", + "dataPath": null, + "paramFormat": "body", + "paramMapping": ["guid", "level"] + }, + "UserKick": { + "method": "PUT", + "url": "/api/v1/users/user-kick", + "dataPath": "data", + "paramFormat": "body", + "paramMapping": ["guid"] + }, + "UserAvatarView": { + "method": "GET", + "url": "/api/v1/users/avatarinfo", + "dataPath": "data.data", + "paramFormat": "query", + "paramMapping": ["guid"] + }, + "UserClothView": { + "method": "GET", + "url": "/api/v1/users/clothinfo", + "dataPath": "data.data", + "paramFormat": "query", + "paramMapping": ["guid"] + }, + "UserToolView": { + "method": "GET", + "url": "/api/v1/users/toolslot", + "dataPath": "data.data", + "paramFormat": "query", + "paramMapping": ["guid"] + }, + "UserInventoryView": { + "method": "GET", + "url": "/api/v1/users/inventory", + "dataPath": "data.data", + "paramFormat": "query", + "paramMapping": ["guid"] + }, + "UserInventoryItemDelete": { + "method": "DELETE", + "url": "/api/v1/users/inventory/delete/item", + "dataPath": "data", + "paramFormat": "body", + "paramMapping": ["guid", "inventory_id"] + }, + "UserTattooView": { + "method": "GET", + "url": "/api/v1/users/tattoo", + "dataPath": "data.data", + "paramFormat": "query", + "paramMapping": ["guid"] + }, + "UserQuestView": { + "method": "GET", + "url": "/api/v1/users/quest", + "dataPath": "data.data", + "paramFormat": "query", + "paramMapping": ["guid"] + }, + "UserFriendListView": { + "method": "GET", + "url": "/api/v1/users/friendlist", + "dataPath": "data.data", + "paramFormat": "query", + "paramMapping": ["guid"] + }, + "UserMailView": { + "method": "POST", + "url": "/api/v1/users/mail", + "dataPath": "data.data", + "paramFormat": "body", + "paramMapping": ["guid", "page", "limit"] + }, + "UserMailDelete": { + "method": "DELETE", + "url": "/api/v1/users/mail/delete", + "dataPath": "data", + "paramFormat": "body", + "paramMapping": ["mail_id"] + }, + "UserMailItemDelete": { + "method": "DELETE", + "url": "/api/v1/users/mail/delete/item", + "dataPath": "data", + "paramFormat": "body", + "paramMapping": ["mail_id", "item_id"] + }, + "UserMailDetailView": { + "method": "GET", + "url": "/api/v1/users/mail/:id", + "dataPath": "data.data", + "paramFormat": "path", + "paramMapping": ["id"] + }, + "UserMyhomeView": { + "method": "GET", + "url": "/api/v1/users/myhome", + "dataPath": "data.data", + "paramFormat": "query", + "paramMapping": ["guid"] + } + } +} \ No newline at end of file diff --git a/src/assets/data/menuConfig.js b/src/assets/data/menuConfig.js index 01c17c8..49c678d 100644 --- a/src/assets/data/menuConfig.js +++ b/src/assets/data/menuConfig.js @@ -194,16 +194,26 @@ export const menuConfig = { view: true, authLevel: adminAuthLevel.NONE }, - menubanner: { - title: '메뉴 배너 관리', + items: { + title: '아이템 관리', permissions: { - read: authType.menuBannerRead, - update: authType.menuBannerUpdate, - delete: authType.menuBannerDelete + read: authType.itemRead, + update: authType.itemUpdate, + delete: authType.itemDelete }, view: true, authLevel: adminAuthLevel.NONE }, + // menubanner: { + // title: '메뉴 배너 관리', + // permissions: { + // read: authType.menuBannerRead, + // update: authType.menuBannerUpdate, + // delete: authType.menuBannerDelete + // }, + // view: true, + // authLevel: adminAuthLevel.NONE + // }, } } }; \ No newline at end of file diff --git a/src/assets/data/options.js b/src/assets/data/options.js index 87b515f..4349ce5 100644 --- a/src/assets/data/options.js +++ b/src/assets/data/options.js @@ -45,10 +45,10 @@ export const mailReceiveType = [ ]; export const adminLevelType = [ - { value: '0', name: '없음' }, - { value: '1', name: 'GM' }, - { value: '2', name: 'Super GM' }, - { value: '3', name: 'Developer' }, + { value: 0, name: '없음' }, + { value: 1, name: 'GM' }, + { value: 2, name: 'Super GM' }, + { value: 3, name: 'Developer' }, ] export const eventStatus = [ @@ -297,6 +297,39 @@ export const opMenuBannerStatus = [ { value: 'FINISH', name: '만료' }, ]; +export const opItemStatus = [ + { value: 'ALL', name: '전체' }, + { value: 'ACTIVE', name: '활성' }, + { value: 'DEACTIVE', name: '비활성' }, +]; + +export const opItemRestore = [ + { value: 'ALL', name: '전체' }, + { value: 'POSSIBLE', name: '가능' }, + { value: 'IMPOSSIBLE', name: '불가능' }, +]; + +export const opEquipType = [ + { value: 0, name: '미장착' }, + { value: 1, name: '의상장착' }, + { value: 2, name: '도구장착' }, + { value: 3, name: '타투장착' }, +] + +export const opItemType = [ + { value: 'TOOL', name: '도구' }, + { value: 'EXPENDABLE', name: '소모품' }, + { value: 'TICKET', name: '티켓' }, + { value: 'RAND_BOX', name: '랜덤 박스' }, + { value: 'CLOTH', name: '의상' }, + { value: 'AVATAR', name: '아바타' }, + { value: 'PROP', name: '프랍' }, + { value: 'TATTOO', name: '타투' }, + { value: 'CURRENCY', name: '재화' }, + { value: 'PRODUCT', name: '제품' }, + { value: 'BEAUTY', name: '뷰티' }, +] + // export const logAction = [ // { value: "None", name: "ALL" }, // { value: "AIChatDeleteCharacter", name: "NPC 삭제" }, @@ -812,70 +845,9 @@ export const logAction = [ export const logDomain = [ { value: "BASE", name: "전체" }, - { value: "AuthLogInOut", name: "AuthLogInOut" }, - { value: "GameLogInOut", name: "GameLogInOut" }, - { value: "UserCreate", name: "UserCreate" }, - { value: "User", name: "User" }, - { value: "UserInitial", name: "UserInitial" }, - { value: "CharacterCreate", name: "CharacterCreate" }, - { value: "Character", name: "Character" }, - { value: "Item", name: "Item" }, - { value: "Currency", name: "Currency" }, - { value: "Mail", name: "Mail" }, - { value: "MailStoragePeriodExpired", name: "MailStoragePeriodExpired" }, - { value: "MailProfile", name: "MailProfile" }, - { value: "Stage", name: "Stage" }, - { value: "ClaimReward", name: "ClaimReward" }, - { value: "QuestMain", name: "QuestMain" }, - { value: "QuestUgq", name: "QuestUgq" }, - { value: "QuestMail", name: "QuestMail" }, - { value: "SocialAction", name: "SocialAction" }, - { value: "MyHome", name: "MyHome" }, - { value: "Taxi", name: "Taxi" }, - { value: "RewardProp", name: "RewardProp" }, - { value: "Party", name: "Party" }, - { value: "PartyMember", name: "PartyMember" }, - { value: "PartyVote", name: "PartyVote" }, - { value: "PartyInstance", name: "PartyInstance" }, - { value: "EscapePosition", name: "EscapePosition" }, - { value: "UserBlock", name: "UserBlock" }, - { value: "Friend", name: "Friend" }, - { value: "UserReport", name: "UserReport" }, - { value: "TaskReservation", name: "TaskReservation" }, - { value: "SeasonPass", name: "SeasonPass" }, - { value: "PackageLastOrderRecode", name: "PackageLastOrderRecode" }, - { value: "PackageRepeat", name: "PackageRepeat" }, - { value: "PackageState", name: "PackageState" }, - { value: "Craft", name: "Craft" }, - { value: "CraftHelp", name: "CraftHelp" }, - { value: "Cart", name: "Cart" }, - { value: "Buff", name: "Buff" }, - { value: "UgqApi", name: "UgqApi" }, - { value: "AIChat", name: "AIChat" }, - { value: "Chat", name: "Chat" }, - { value: "Shop", name: "Shop" }, - { value: "Calium", name: "Calium" }, - { value: "CaliumEchoSystem", name: "CaliumEchoSystem" }, - { value: "CaliumStorageFail", name: "CaliumStorageFail" }, - { value: "Position", name: "Position" }, { value: "Address", name: "Address" }, - { value: "BeaconCreate", name: "BeaconCreate" }, - { value: "Beacon", name: "Beacon" }, - { value: "CustomDefineUi", name: "CustomDefineUi" }, - { value: "Farming", name: "Farming" }, - { value: "FarmingReward", name: "FarmingReward" }, - { value: "RenewalShopProducts", name: "RenewalShopProducts" }, - { value: "CheatRenewalShopProducts", name: "CheatRenewalShopProducts" }, - { value: "ChangeDanceEntityState", name: "ChangeDanceEntityState" }, - { value: "Land", name: "Land" }, - { value: "Building", name: "Building" }, - { value: "SwitchingProp", name: "SwitchingProp" }, - { value: "LandAuction", name: "LandAuction" }, - { value: "LandAuctionActivity", name: "LandAuctionActivity" }, - { value: "LandAuctionBid", name: "LandAuctionBid" }, - { value: "LandAuctionBidPriceRefund", name: "LandAuctionBidPriceRefund" }, - { value: "BrokerApi", name: "BrokerApi" }, - { value: "Rental", name: "Rental" }, + { value: "AIChat", name: "AIChat" }, + { value: "AuthLogInOut", name: "AuthLogInOut" }, { value: "BuildingProfit", name: "BuildingProfit" }, { value: "BattleObjectInteraction", name: "BattleObjectInteraction" }, { value: "BattleObjectStateUpdate", name: "BattleObjectStateUpdate" }, @@ -884,5 +856,66 @@ export const logDomain = [ { value: "BattleRoomJoin", name: "BattleRoomJoin" }, { value: "BattleDead", name: "BattleDead" }, { value: "BattleRound", name: "BattleRound" }, - { value: "BattleSnapshot", name: "BattleSnapshot" } + { value: "BattleSnapshot", name: "BattleSnapshot" }, + { value: "BeaconCreate", name: "BeaconCreate" }, + { value: "Beacon", name: "Beacon" }, + { value: "BrokerApi", name: "BrokerApi" }, + { value: "Buff", name: "Buff" }, + { value: "Building", name: "Building" }, + { value: "Calium", name: "Calium" }, + { value: "CaliumEchoSystem", name: "CaliumEchoSystem" }, + { value: "CaliumStorageFail", name: "CaliumStorageFail" }, + { value: "Character", name: "Character" }, + { value: "CharacterCreate", name: "CharacterCreate" }, + { value: "Chat", name: "Chat" }, + { value: "CheatRenewalShopProducts", name: "CheatRenewalShopProducts" }, + { value: "ChangeDanceEntityState", name: "ChangeDanceEntityState" }, + { value: "ClaimReward", name: "ClaimReward" }, + { value: "Craft", name: "Craft" }, + { value: "CraftHelp", name: "CraftHelp" }, + { value: "Cart", name: "Cart" }, + { value: "Currency", name: "Currency" }, + { value: "CustomDefineUi", name: "CustomDefineUi" }, + { value: "EscapePosition", name: "EscapePosition" }, + { value: "Friend", name: "Friend" }, + { value: "Farming", name: "Farming" }, + { value: "FarmingReward", name: "FarmingReward" }, + { value: "GameLogInOut", name: "GameLogInOut" }, + { value: "Item", name: "Item" }, + { value: "MyHome", name: "MyHome" }, + { value: "Land", name: "Land" }, + { value: "LandAuction", name: "LandAuction" }, + { value: "LandAuctionActivity", name: "LandAuctionActivity" }, + { value: "LandAuctionBid", name: "LandAuctionBid" }, + { value: "LandAuctionBidPriceRefund", name: "LandAuctionBidPriceRefund" }, + { value: "Mail", name: "Mail" }, + { value: "MailStoragePeriodExpired", name: "MailStoragePeriodExpired" }, + { value: "MailProfile", name: "MailProfile" }, + { value: "Party", name: "Party" }, + { value: "PartyMember", name: "PartyMember" }, + { value: "PartyVote", name: "PartyVote" }, + { value: "PartyInstance", name: "PartyInstance" }, + { value: "Position", name: "Position" }, + { value: "PackageLastOrderRecode", name: "PackageLastOrderRecode" }, + { value: "PackageRepeat", name: "PackageRepeat" }, + { value: "PackageState", name: "PackageState" }, + { value: "QuestMain", name: "QuestMain" }, + { value: "QuestUgq", name: "QuestUgq" }, + { value: "QuestMail", name: "QuestMail" }, + { value: "RenewalShopProducts", name: "RenewalShopProducts" }, + { value: "Rental", name: "Rental" }, + { value: "RewardProp", name: "RewardProp" }, + { value: "Stage", name: "Stage" }, + { value: "SocialAction", name: "SocialAction" }, + { value: "SeasonPass", name: "SeasonPass" }, + { value: "Shop", name: "Shop" }, + { value: "SwitchingProp", name: "SwitchingProp" }, + { value: "Taxi", name: "Taxi" }, + { value: "TaskReservation", name: "TaskReservation" }, + { value: "UgqApi", name: "UgqApi" }, + { value: "User", name: "User" }, + { value: "UserCreate", name: "UserCreate" }, + { value: "UserInitial", name: "UserInitial" }, + { value: "UserBlock", name: "UserBlock" }, + { value: "UserReport", name: "UserReport" }, ]; diff --git a/src/assets/data/pages/itemSearch.json b/src/assets/data/pages/itemSearch.json new file mode 100644 index 0000000..32047e4 --- /dev/null +++ b/src/assets/data/pages/itemSearch.json @@ -0,0 +1,39 @@ +{ + "initialSearchParams": { + "searchType": "GUID", + "searchData": "", + "orderBy": "DESC", + "pageSize": 50, + "currentPage": 1, + "lastEvaluatedKey": null + }, + "searchFields": [ + { + "type": "select", + "id": "searchType", + "label": "대상", + "optionsRef": "userSearchType", + "col": 1, + "required": true + }, + { + "type": "text", + "id": "searchData", + "placeholder": "대상 입력", + "width": "300px", + "col": 1, + "required": true + } + ], + + "apiInfo": { + "endpointName": "ItemList", + "loadOnMount": false, + "pageField": "page_no", + "pageSizeField": "page_size", + "orderField": "orderBy", + "lastPageKeyField": "pageKey" + }, + "paginationType": "dynamodb", + "initSearch": false +} \ No newline at end of file diff --git a/src/assets/data/pages/itemTable.json b/src/assets/data/pages/itemTable.json new file mode 100644 index 0000000..4afbc73 --- /dev/null +++ b/src/assets/data/pages/itemTable.json @@ -0,0 +1,90 @@ +{ + "id": "itemTable", + "selection": { + "type": "single", + "idField": "id" + }, + "header": { + "countType": "total", + "orderType": "desc", + "pageType": "default", + "buttons": [ + { + "id": "delete", + "text": "선택 삭제", + "theme": "line", + "disableWhen": "noSelection", + "requiredAuth": "itemDelete", + "action": "delete" + }, + { + "id": "restore", + "text": "아이템 복구", + "theme": "line", + "disableWhen": "disable", + "requiredAuth": "itemDelete", + "action": "restore" + } + ] + }, + "columns": [ + { + "id": "checkbox", + "type": "checkbox", + "width": "40px", + "title": "" + }, + { + "id": "item_name", + "type": "text", + "width": "20%", + "title": "아이템명" + }, + { + "id": "item_id", + "type": "text", + "width": "20%", + "title": "아이템 ID" + }, + { + "id": "count", + "type": "text", + "width": "80px", + "title": "수량" + }, + { + "id": "item_type", + "type": "option", + "width": "120px", + "title": "아이템 타입", + "option_name": "opItemType" + }, + { + "id": "equip_type", + "type": "option", + "width": "80px", + "title": "장착", + "option_name": "opEquipType" + }, + { + "id": "equiped_pos", + "type": "text", + "width": "80px", + "title": "슬롯" + }, + { + "id": "create_dt", + "type": "date", + "width": "100px", + "title": "생성날짜(KST)", + "format": { + "type": "function", + "name": "convertKTC" + } + } + ], + "sort": { + "defaultColumn": "row_num", + "defaultDirection": "desc" + } +} \ No newline at end of file diff --git a/src/assets/data/pages/menuBannerSearch.json b/src/assets/data/pages/menuBannerSearch.json index a119b86..29ee741 100644 --- a/src/assets/data/pages/menuBannerSearch.json +++ b/src/assets/data/pages/menuBannerSearch.json @@ -35,19 +35,14 @@ ], "apiInfo": { - "functionName": "MenuBannerView", + "endpointName": "MenuBannerView", "loadOnMount": true, - "paramsMapping": [ - "searchData", - "status", + "paramTransforms": [ {"param": "startDate", "transform": "toISOString"}, - {"param": "endDate", "transform": "toISOString"}, - "orderBy", - "pageSize", - "currentPage" + {"param": "endDate", "transform": "toISOString"} ], - "pageField": "currentPage", - "pageSizeField": "pageSize", + "pageField": "page_no", + "pageSizeField": "page_size", "orderField": "orderBy" } } \ No newline at end of file diff --git a/src/assets/data/pages/userBlockSearch.json b/src/assets/data/pages/userBlockSearch.json index ed294ee..960c47c 100644 --- a/src/assets/data/pages/userBlockSearch.json +++ b/src/assets/data/pages/userBlockSearch.json @@ -16,7 +16,7 @@ "type": "select", "id": "searchType", "label": "대상", - "optionsRef": "eventStatus", + "optionsRef": "userSearchType", "col": 1 }, { diff --git a/src/components/DataManage/UserAvatarInfo.js b/src/components/DataManage/UserAvatarInfo.js index 4f16563..969b7b7 100644 --- a/src/components/DataManage/UserAvatarInfo.js +++ b/src/components/DataManage/UserAvatarInfo.js @@ -8,7 +8,9 @@ const UserAvatarInfo = ({ userInfo }) => { const [loading, setLoading] = useState(true); useEffect(() => { - fetchData(); + if(userInfo && Object.keys(userInfo).length > 0) { + fetchData(); + } }, []); const fetchData = async () => { diff --git a/src/components/DataManage/UserDefaultInfo.js b/src/components/DataManage/UserDefaultInfo.js index fe6ff8b..2a489ff 100644 --- a/src/components/DataManage/UserDefaultInfo.js +++ b/src/components/DataManage/UserDefaultInfo.js @@ -20,23 +20,25 @@ import { opUserSessionType } from '../../assets/data/options'; import Button from '../common/button/Button'; import { useModal } from '../../hooks/hook'; import { InitData } from '../../apis/Data'; +import { useAlert } from '../../context/AlertProvider'; +import { useLoading } from '../../context/LoadingProvider'; +import { alertTypes } from '../../assets/data/types'; const UserDefaultInfo = ({ userInfo }) => { const { t } = useTranslation(); const authInfo = useRecoilValue(authList); const token = sessionStorage.getItem('token'); + const {showModal, showToast} = useAlert(); + const {withLoading} = useLoading(); + const { modalState, handleModalView, handleModalClose } = useModal({ - userKick: 'hidden', - gmLevelChange: 'hidden', pwChange: 'hidden' }); - const [alertMsg, setAlertMsg] = useState(''); const [dataList, setDataList] = useState({}); - const [adminLevel, setAdminLevel] = useState('0'); const [loading, setLoading] = useState(true); const [authDelete, setAuthDelete] = useState(false); @@ -45,7 +47,9 @@ const UserDefaultInfo = ({ userInfo }) => { }, [authInfo]); useEffect(() => { - fetchData(); + if(userInfo && Object.keys(userInfo).length > 0) { + fetchData(); + } }, [userInfo]); const fetchData = async () => { @@ -61,48 +65,46 @@ const UserDefaultInfo = ({ userInfo }) => { switch (type) { case "gmLevelChangeSubmit": - setAdminLevel(param); - - handleModalView('gmLevelChange'); + showModal('USER_GM_CHANGE', { + type: alertTypes.confirm, + onConfirm: () => handleSubmit('gmLevelChange', param) + }); break; + case "userKickSubmit": - handleModalView('userKick'); + showModal('USER_KICK_CONFIRM', { + type: alertTypes.confirm, + onConfirm: () => handleSubmit('userKick') + }); break; + case "gmLevelChange": - setLoading(true); - params.guid = userInfo.guid; - params.admin_level = adminLevel; + params.admin_level = param; - await UserChangeAdminLevel(token, params).then(data =>{ - setAlertMsg(t('USER_GM_CHANGE_COMPLETE')) + await withLoading(async () => { + return await UserChangeAdminLevel(token, params); + }).then(data =>{ + showToast('USER_GM_CHANGE_COMPLETE', {type: alertTypes.success}); }).catch(error => { - console.log(error); + showToast(error, {type: alertTypes.error}); }).finally(() => { - setLoading(false); - handleModalClose('gmLevelChange'); fetchData(); }); - break; + case "userKick": params.guid = userInfo.guid; - await UserKick(token, params).then((data) =>{ - setAlertMsg(t('USER_KICK_COMPLETE')) + await withLoading(async () => { + return await UserKick(token, params); + }).then((data) =>{ + showToast('USER_KICK_COMPLETE', {type: alertTypes.success}); }).catch(error => { - console.log(error); + showToast(error, {type: alertTypes.error}); }).finally(() => { - setLoading(false); - handleModalClose('userKick'); fetchData(); }); break; - case "registComplete": - handleModalClose('registComplete'); - break; - case "warning": - setAlertMsg(''); - break; } } @@ -131,12 +133,13 @@ const UserDefaultInfo = ({ userInfo }) => { 접속상태 {dataList.user_session !== undefined && opUserSessionType.find(session => session.value === dataList.user_session)?.name} - {