diff --git a/schema.graphql b/schema.graphql index 9fed07a1e..444a7d873 100644 --- a/schema.graphql +++ b/schema.graphql @@ -848,7 +848,7 @@ type ChannelDelete { } input ChannelDeleteInput { - targetChannel: ID! + channelId: ID! } type ChannelError { @@ -865,7 +865,6 @@ enum ChannelErrorCode { NOT_FOUND REQUIRED UNIQUE - CHANNEL_TARGET_ID_MUST_BE_DIFFERENT CHANNELS_CURRENCY_MUST_BE_THE_SAME CHANNEL_WITH_ORDERS DUPLICATED_INPUT_ITEM @@ -1842,7 +1841,7 @@ input DraftOrderCreateInput { shippingMethod: ID voucher: ID customerNote: String - channel: ID + channelId: ID redirectUrl: String lines: [OrderLineCreateInput] } @@ -1862,7 +1861,7 @@ input DraftOrderInput { shippingMethod: ID voucher: ID customerNote: String - channel: ID + channelId: ID redirectUrl: String } @@ -2823,7 +2822,7 @@ type Mutation { giftCardCreate(input: GiftCardCreateInput!): GiftCardCreate giftCardDeactivate(id: ID!): GiftCardDeactivate giftCardUpdate(id: ID!, input: GiftCardUpdateInput!): GiftCardUpdate - pluginUpdate(channel: ID, id: ID!, input: PluginUpdateInput!): PluginUpdate + pluginUpdate(channelId: ID, id: ID!, input: PluginUpdateInput!): PluginUpdate saleCreate(input: SaleInput!): SaleCreate saleDelete(id: ID!): SaleDelete saleBulkDelete(ids: [ID]!): SaleBulkDelete diff --git a/src/channels/views/ChannelDetails/ChannelDetails.tsx b/src/channels/views/ChannelDetails/ChannelDetails.tsx index c4c1943bf..2f204785d 100644 --- a/src/channels/views/ChannelDetails/ChannelDetails.tsx +++ b/src/channels/views/ChannelDetails/ChannelDetails.tsx @@ -145,10 +145,8 @@ export const ChannelDetails: React.FC = ({ channelsListData?.data?.channels ); - const handleRemoveConfirm = (targetChannelId?: string) => { - const data = targetChannelId - ? { id, input: { targetChannel: targetChannelId } } - : { id }; + const handleRemoveConfirm = (channelId?: string) => { + const data = channelId ? { id, input: { channelId } } : { id }; deleteChannel({ variables: data }); }; diff --git a/src/channels/views/ChannelsList/ChannelsList.tsx b/src/channels/views/ChannelsList/ChannelsList.tsx index 9d11e4f6e..1ef5ad354 100644 --- a/src/channels/views/ChannelsList/ChannelsList.tsx +++ b/src/channels/views/ChannelsList/ChannelsList.tsx @@ -80,16 +80,15 @@ export const ChannelsList: React.FC = ({ params }) => { const navigateToChannelCreate = () => navigate(channelAddUrl); - const handleRemoveConfirm = (targetChannelId?: string) => { - if (targetChannelId) { - deleteChannel({ - variables: { id: params.id, input: { targetChannel: targetChannelId } } - }); - } else { - deleteChannel({ - variables: { id: params.id } - }); - } + const handleRemoveConfirm = (channelId?: string) => { + const inputVariables = channelId ? { input: { channelId } } : {}; + + deleteChannel({ + variables: { + id: params.id, + ...inputVariables + } + }); }; return ( diff --git a/src/orders/views/OrderDraftList/OrderDraftList.tsx b/src/orders/views/OrderDraftList/OrderDraftList.tsx index e021fdb5e..f6cec36be 100644 --- a/src/orders/views/OrderDraftList/OrderDraftList.tsx +++ b/src/orders/views/OrderDraftList/OrderDraftList.tsx @@ -262,10 +262,10 @@ export const OrderDraftList: React.FC = ({ params }) => { defaultChoice={channel?.id} open={params.action === "create-order"} onClose={closeModal} - onConfirm={channel => + onConfirm={channelId => createOrder({ variables: { - input: { channel } + input: { channelId } } }) } diff --git a/src/orders/views/OrderList/OrderList.tsx b/src/orders/views/OrderList/OrderList.tsx index d0675b783..e6a306b58 100644 --- a/src/orders/views/OrderList/OrderList.tsx +++ b/src/orders/views/OrderList/OrderList.tsx @@ -196,10 +196,10 @@ export const OrderList: React.FC = ({ params }) => { defaultChoice={channel.id} open={params.action === "create-order"} onClose={closeModal} - onConfirm={channel => + onConfirm={channelId => createOrder({ variables: { - input: { channel } + input: { channelId } } }) } diff --git a/src/plugins/mutations.ts b/src/plugins/mutations.ts index 8f686aa6d..b39ba9d39 100644 --- a/src/plugins/mutations.ts +++ b/src/plugins/mutations.ts @@ -8,8 +8,8 @@ import { PluginUpdate, PluginUpdateVariables } from "./types/PluginUpdate"; const pluginUpdate = gql` ${pluginsDetailsFragment} ${pluginErrorFragment} - mutation PluginUpdate($channel: ID, $id: ID!, $input: PluginUpdateInput!) { - pluginUpdate(channel: $channel, id: $id, input: $input) { + mutation PluginUpdate($channelId: ID, $id: ID!, $input: PluginUpdateInput!) { + pluginUpdate(channelId: $channelId, id: $id, input: $input) { errors { ...PluginErrorFragment } diff --git a/src/plugins/types/PluginUpdate.ts b/src/plugins/types/PluginUpdate.ts index f7aba7041..578d88bf6 100644 --- a/src/plugins/types/PluginUpdate.ts +++ b/src/plugins/types/PluginUpdate.ts @@ -81,7 +81,7 @@ export interface PluginUpdate { } export interface PluginUpdateVariables { - channel?: string | null; + channelId?: string | null; id: string; input: PluginUpdateInput; } diff --git a/src/plugins/views/PluginsDetails.tsx b/src/plugins/views/PluginsDetails.tsx index 89b92c692..f0fa6a938 100644 --- a/src/plugins/views/PluginsDetails.tsx +++ b/src/plugins/views/PluginsDetails.tsx @@ -102,7 +102,7 @@ export const PluginsDetails: React.FC = ({ const handleFieldUpdate = (value: string) => pluginUpdate({ variables: { - channel: selectedChannelId, + channelId: selectedChannelId, id, input: { configuration: [ @@ -118,7 +118,7 @@ export const PluginsDetails: React.FC = ({ const handleSubmit = async (formData: PluginDetailsPageFormData) => { const result = await pluginUpdate({ variables: { - channel: selectedChannelId, + channelId: selectedChannelId, id, input: { active: formData.active, diff --git a/src/types/globalTypes.ts b/src/types/globalTypes.ts index 8f9e814e2..5804e1cb2 100644 --- a/src/types/globalTypes.ts +++ b/src/types/globalTypes.ts @@ -122,7 +122,6 @@ export enum CategorySortField { export enum ChannelErrorCode { ALREADY_EXISTS = "ALREADY_EXISTS", CHANNELS_CURRENCY_MUST_BE_THE_SAME = "CHANNELS_CURRENCY_MUST_BE_THE_SAME", - CHANNEL_TARGET_ID_MUST_BE_DIFFERENT = "CHANNEL_TARGET_ID_MUST_BE_DIFFERENT", CHANNEL_WITH_ORDERS = "CHANNEL_WITH_ORDERS", DUPLICATED_INPUT_ITEM = "DUPLICATED_INPUT_ITEM", GRAPHQL_ERROR = "GRAPHQL_ERROR", @@ -1203,7 +1202,7 @@ export interface ChannelCreateInput { } export interface ChannelDeleteInput { - targetChannel: string; + channelId: string; } export interface ChannelUpdateInput { @@ -1298,7 +1297,7 @@ export interface DraftOrderCreateInput { shippingMethod?: string | null; voucher?: string | null; customerNote?: string | null; - channel?: string | null; + channelId?: string | null; redirectUrl?: string | null; lines?: (OrderLineCreateInput | null)[] | null; } @@ -1312,7 +1311,7 @@ export interface DraftOrderInput { shippingMethod?: string | null; voucher?: string | null; customerNote?: string | null; - channel?: string | null; + channelId?: string | null; redirectUrl?: string | null; }