Unify channel ID param in graphql (#1131)
* Update schema & types * Change channel param to channelId in create order mutation usages * Update types and plugin update mutation params * Change usages of channel in graphql mutation params to channelId
This commit is contained in:
parent
852bc127f6
commit
50764b5932
9 changed files with 27 additions and 32 deletions
|
@ -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
|
||||
|
|
|
@ -145,10 +145,8 @@ export const ChannelDetails: React.FC<ChannelDetailsProps> = ({
|
|||
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 });
|
||||
};
|
||||
|
||||
|
|
|
@ -80,16 +80,15 @@ export const ChannelsList: React.FC<ChannelsListProps> = ({ 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 (
|
||||
|
|
|
@ -262,10 +262,10 @@ export const OrderDraftList: React.FC<OrderDraftListProps> = ({ params }) => {
|
|||
defaultChoice={channel?.id}
|
||||
open={params.action === "create-order"}
|
||||
onClose={closeModal}
|
||||
onConfirm={channel =>
|
||||
onConfirm={channelId =>
|
||||
createOrder({
|
||||
variables: {
|
||||
input: { channel }
|
||||
input: { channelId }
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -196,10 +196,10 @@ export const OrderList: React.FC<OrderListProps> = ({ params }) => {
|
|||
defaultChoice={channel.id}
|
||||
open={params.action === "create-order"}
|
||||
onClose={closeModal}
|
||||
onConfirm={channel =>
|
||||
onConfirm={channelId =>
|
||||
createOrder({
|
||||
variables: {
|
||||
input: { channel }
|
||||
input: { channelId }
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ export interface PluginUpdate {
|
|||
}
|
||||
|
||||
export interface PluginUpdateVariables {
|
||||
channel?: string | null;
|
||||
channelId?: string | null;
|
||||
id: string;
|
||||
input: PluginUpdateInput;
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ export const PluginsDetails: React.FC<PluginsDetailsProps> = ({
|
|||
const handleFieldUpdate = (value: string) =>
|
||||
pluginUpdate({
|
||||
variables: {
|
||||
channel: selectedChannelId,
|
||||
channelId: selectedChannelId,
|
||||
id,
|
||||
input: {
|
||||
configuration: [
|
||||
|
@ -118,7 +118,7 @@ export const PluginsDetails: React.FC<PluginsDetailsProps> = ({
|
|||
const handleSubmit = async (formData: PluginDetailsPageFormData) => {
|
||||
const result = await pluginUpdate({
|
||||
variables: {
|
||||
channel: selectedChannelId,
|
||||
channelId: selectedChannelId,
|
||||
id,
|
||||
input: {
|
||||
active: formData.active,
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue