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 {
|
input ChannelDeleteInput {
|
||||||
targetChannel: ID!
|
channelId: ID!
|
||||||
}
|
}
|
||||||
|
|
||||||
type ChannelError {
|
type ChannelError {
|
||||||
|
@ -865,7 +865,6 @@ enum ChannelErrorCode {
|
||||||
NOT_FOUND
|
NOT_FOUND
|
||||||
REQUIRED
|
REQUIRED
|
||||||
UNIQUE
|
UNIQUE
|
||||||
CHANNEL_TARGET_ID_MUST_BE_DIFFERENT
|
|
||||||
CHANNELS_CURRENCY_MUST_BE_THE_SAME
|
CHANNELS_CURRENCY_MUST_BE_THE_SAME
|
||||||
CHANNEL_WITH_ORDERS
|
CHANNEL_WITH_ORDERS
|
||||||
DUPLICATED_INPUT_ITEM
|
DUPLICATED_INPUT_ITEM
|
||||||
|
@ -1842,7 +1841,7 @@ input DraftOrderCreateInput {
|
||||||
shippingMethod: ID
|
shippingMethod: ID
|
||||||
voucher: ID
|
voucher: ID
|
||||||
customerNote: String
|
customerNote: String
|
||||||
channel: ID
|
channelId: ID
|
||||||
redirectUrl: String
|
redirectUrl: String
|
||||||
lines: [OrderLineCreateInput]
|
lines: [OrderLineCreateInput]
|
||||||
}
|
}
|
||||||
|
@ -1862,7 +1861,7 @@ input DraftOrderInput {
|
||||||
shippingMethod: ID
|
shippingMethod: ID
|
||||||
voucher: ID
|
voucher: ID
|
||||||
customerNote: String
|
customerNote: String
|
||||||
channel: ID
|
channelId: ID
|
||||||
redirectUrl: String
|
redirectUrl: String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2823,7 +2822,7 @@ type Mutation {
|
||||||
giftCardCreate(input: GiftCardCreateInput!): GiftCardCreate
|
giftCardCreate(input: GiftCardCreateInput!): GiftCardCreate
|
||||||
giftCardDeactivate(id: ID!): GiftCardDeactivate
|
giftCardDeactivate(id: ID!): GiftCardDeactivate
|
||||||
giftCardUpdate(id: ID!, input: GiftCardUpdateInput!): GiftCardUpdate
|
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
|
saleCreate(input: SaleInput!): SaleCreate
|
||||||
saleDelete(id: ID!): SaleDelete
|
saleDelete(id: ID!): SaleDelete
|
||||||
saleBulkDelete(ids: [ID]!): SaleBulkDelete
|
saleBulkDelete(ids: [ID]!): SaleBulkDelete
|
||||||
|
|
|
@ -145,10 +145,8 @@ export const ChannelDetails: React.FC<ChannelDetailsProps> = ({
|
||||||
channelsListData?.data?.channels
|
channelsListData?.data?.channels
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleRemoveConfirm = (targetChannelId?: string) => {
|
const handleRemoveConfirm = (channelId?: string) => {
|
||||||
const data = targetChannelId
|
const data = channelId ? { id, input: { channelId } } : { id };
|
||||||
? { id, input: { targetChannel: targetChannelId } }
|
|
||||||
: { id };
|
|
||||||
deleteChannel({ variables: data });
|
deleteChannel({ variables: data });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -80,16 +80,15 @@ export const ChannelsList: React.FC<ChannelsListProps> = ({ params }) => {
|
||||||
|
|
||||||
const navigateToChannelCreate = () => navigate(channelAddUrl);
|
const navigateToChannelCreate = () => navigate(channelAddUrl);
|
||||||
|
|
||||||
const handleRemoveConfirm = (targetChannelId?: string) => {
|
const handleRemoveConfirm = (channelId?: string) => {
|
||||||
if (targetChannelId) {
|
const inputVariables = channelId ? { input: { channelId } } : {};
|
||||||
deleteChannel({
|
|
||||||
variables: { id: params.id, input: { targetChannel: targetChannelId } }
|
deleteChannel({
|
||||||
});
|
variables: {
|
||||||
} else {
|
id: params.id,
|
||||||
deleteChannel({
|
...inputVariables
|
||||||
variables: { id: params.id }
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -262,10 +262,10 @@ export const OrderDraftList: React.FC<OrderDraftListProps> = ({ params }) => {
|
||||||
defaultChoice={channel?.id}
|
defaultChoice={channel?.id}
|
||||||
open={params.action === "create-order"}
|
open={params.action === "create-order"}
|
||||||
onClose={closeModal}
|
onClose={closeModal}
|
||||||
onConfirm={channel =>
|
onConfirm={channelId =>
|
||||||
createOrder({
|
createOrder({
|
||||||
variables: {
|
variables: {
|
||||||
input: { channel }
|
input: { channelId }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -196,10 +196,10 @@ export const OrderList: React.FC<OrderListProps> = ({ params }) => {
|
||||||
defaultChoice={channel.id}
|
defaultChoice={channel.id}
|
||||||
open={params.action === "create-order"}
|
open={params.action === "create-order"}
|
||||||
onClose={closeModal}
|
onClose={closeModal}
|
||||||
onConfirm={channel =>
|
onConfirm={channelId =>
|
||||||
createOrder({
|
createOrder({
|
||||||
variables: {
|
variables: {
|
||||||
input: { channel }
|
input: { channelId }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,8 @@ import { PluginUpdate, PluginUpdateVariables } from "./types/PluginUpdate";
|
||||||
const pluginUpdate = gql`
|
const pluginUpdate = gql`
|
||||||
${pluginsDetailsFragment}
|
${pluginsDetailsFragment}
|
||||||
${pluginErrorFragment}
|
${pluginErrorFragment}
|
||||||
mutation PluginUpdate($channel: ID, $id: ID!, $input: PluginUpdateInput!) {
|
mutation PluginUpdate($channelId: ID, $id: ID!, $input: PluginUpdateInput!) {
|
||||||
pluginUpdate(channel: $channel, id: $id, input: $input) {
|
pluginUpdate(channelId: $channelId, id: $id, input: $input) {
|
||||||
errors {
|
errors {
|
||||||
...PluginErrorFragment
|
...PluginErrorFragment
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ export interface PluginUpdate {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PluginUpdateVariables {
|
export interface PluginUpdateVariables {
|
||||||
channel?: string | null;
|
channelId?: string | null;
|
||||||
id: string;
|
id: string;
|
||||||
input: PluginUpdateInput;
|
input: PluginUpdateInput;
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,7 @@ export const PluginsDetails: React.FC<PluginsDetailsProps> = ({
|
||||||
const handleFieldUpdate = (value: string) =>
|
const handleFieldUpdate = (value: string) =>
|
||||||
pluginUpdate({
|
pluginUpdate({
|
||||||
variables: {
|
variables: {
|
||||||
channel: selectedChannelId,
|
channelId: selectedChannelId,
|
||||||
id,
|
id,
|
||||||
input: {
|
input: {
|
||||||
configuration: [
|
configuration: [
|
||||||
|
@ -118,7 +118,7 @@ export const PluginsDetails: React.FC<PluginsDetailsProps> = ({
|
||||||
const handleSubmit = async (formData: PluginDetailsPageFormData) => {
|
const handleSubmit = async (formData: PluginDetailsPageFormData) => {
|
||||||
const result = await pluginUpdate({
|
const result = await pluginUpdate({
|
||||||
variables: {
|
variables: {
|
||||||
channel: selectedChannelId,
|
channelId: selectedChannelId,
|
||||||
id,
|
id,
|
||||||
input: {
|
input: {
|
||||||
active: formData.active,
|
active: formData.active,
|
||||||
|
|
|
@ -122,7 +122,6 @@ export enum CategorySortField {
|
||||||
export enum ChannelErrorCode {
|
export enum ChannelErrorCode {
|
||||||
ALREADY_EXISTS = "ALREADY_EXISTS",
|
ALREADY_EXISTS = "ALREADY_EXISTS",
|
||||||
CHANNELS_CURRENCY_MUST_BE_THE_SAME = "CHANNELS_CURRENCY_MUST_BE_THE_SAME",
|
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",
|
CHANNEL_WITH_ORDERS = "CHANNEL_WITH_ORDERS",
|
||||||
DUPLICATED_INPUT_ITEM = "DUPLICATED_INPUT_ITEM",
|
DUPLICATED_INPUT_ITEM = "DUPLICATED_INPUT_ITEM",
|
||||||
GRAPHQL_ERROR = "GRAPHQL_ERROR",
|
GRAPHQL_ERROR = "GRAPHQL_ERROR",
|
||||||
|
@ -1203,7 +1202,7 @@ export interface ChannelCreateInput {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ChannelDeleteInput {
|
export interface ChannelDeleteInput {
|
||||||
targetChannel: string;
|
channelId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ChannelUpdateInput {
|
export interface ChannelUpdateInput {
|
||||||
|
@ -1298,7 +1297,7 @@ export interface DraftOrderCreateInput {
|
||||||
shippingMethod?: string | null;
|
shippingMethod?: string | null;
|
||||||
voucher?: string | null;
|
voucher?: string | null;
|
||||||
customerNote?: string | null;
|
customerNote?: string | null;
|
||||||
channel?: string | null;
|
channelId?: string | null;
|
||||||
redirectUrl?: string | null;
|
redirectUrl?: string | null;
|
||||||
lines?: (OrderLineCreateInput | null)[] | null;
|
lines?: (OrderLineCreateInput | null)[] | null;
|
||||||
}
|
}
|
||||||
|
@ -1312,7 +1311,7 @@ export interface DraftOrderInput {
|
||||||
shippingMethod?: string | null;
|
shippingMethod?: string | null;
|
||||||
voucher?: string | null;
|
voucher?: string | null;
|
||||||
customerNote?: string | null;
|
customerNote?: string | null;
|
||||||
channel?: string | null;
|
channelId?: string | null;
|
||||||
redirectUrl?: string | null;
|
redirectUrl?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue