Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Update mutation types

dominik-zeglend5dd6c519a60
diff --git a/saleor/static/dashboard-next/orders/containers/OrderCreateFulfillment.tsx b/saleor/static/dashboard-next/orders/containers/OrderCreateFulfillment.tsx
index 7f111c8c23..2cb158d866 100644
--- a/saleor/static/dashboard-next/orders/containers/OrderCreateFulfillment.tsx
+++ b/saleor/static/dashboard-next/orders/containers/OrderCreateFulfillment.tsx
@@ -1,10 +1,10 @@
import * as React from "react";
-import {
- OrderCreateFulfillmentMutation,
- OrderCreateFulfillmentMutationVariables
-} from "../../gql-types";
import { TypedOrderCreateFulfillmentMutation } from "../mutations";
+import {
+ OrderCreateFulfillment,
+ OrderCreateFulfillmentVariables
+} from "../types/OrderCreateFulfillment";
import {
PartialMutationProviderProps,
@@ -12,11 +12,11 @@ import {
} from "../..";
interface OrderCreateFulfillmentProviderProps
- extends PartialMutationProviderProps<OrderCreateFulfillmentMutation> {
+ extends PartialMutationProviderProps<OrderCreateFulfillment> {
id: string;
children: PartialMutationProviderRenderProps<
- OrderCreateFulfillmentMutation,
- OrderCreateFulfillmentMutationVariables
+ OrderCreateFulfillment,
+ OrderCreateFulfillmentVariables
>;
}
diff --git a/saleor/static/dashboard-next/orders/containers/OrderOperations.tsx b/saleor/static/dashboard-next/orders/containers/OrderOperations.tsx
index fe086379b1..49ba739fd9 100644
--- a/saleor/static/dashboard-next/orders/containers/OrderOperations.tsx
+++ b/saleor/static/dashboard-next/orders/containers/OrderOperations.tsx
@@ -5,23 +5,20 @@ import {
MutationProviderRenderProps,
PartialMutationProviderOutput
} from "../..";
-import {
- OrderCaptureMutation,
- OrderCaptureMutationVariables,
- OrderCreateFulfillmentMutation,
- OrderCreateFulfillmentMutationVariables,
- OrderRefundMutation,
- OrderRefundMutationVariables,
- OrderReleaseMutation,
- OrderReleaseMutationVariables
-} from "../../gql-types";
import { maybe } from "../../misc";
import { OrderAddNote, OrderAddNoteVariables } from "../types/OrderAddNote";
import { OrderCancel, OrderCancelVariables } from "../types/OrderCancel";
+import { OrderCapture, OrderCaptureVariables } from "../types/OrderCapture";
+import {
+ OrderCreateFulfillment,
+ OrderCreateFulfillmentVariables
+} from "../types/OrderCreateFulfillment";
import {
OrderDraftUpdate,
OrderDraftUpdateVariables
} from "../types/OrderDraftUpdate";
+import { OrderRefund, OrderRefundVariables } from "../types/OrderRefund";
+import { OrderRelease, OrderReleaseVariables } from "../types/OrderRelease";
import {
OrderShippingMethodUpdate,
OrderShippingMethodUpdateVariables
@@ -49,20 +46,20 @@ interface OrderOperationsProps extends MutationProviderProps {
OrderCancelVariables
>;
orderCreateFulfillment: PartialMutationProviderOutput<
- OrderCreateFulfillmentMutation,
- OrderCreateFulfillmentMutationVariables
+ OrderCreateFulfillment,
+ OrderCreateFulfillmentVariables
>;
orderPaymentCapture: PartialMutationProviderOutput<
- OrderCaptureMutation,
- OrderCaptureMutationVariables
+ OrderCapture,
+ OrderCaptureVariables
>;
orderPaymentRefund: PartialMutationProviderOutput<
- OrderRefundMutation,
- OrderRefundMutationVariables
+ OrderRefund,
+ OrderRefundVariables
>;
orderRelease: PartialMutationProviderOutput<
- OrderReleaseMutation,
- OrderReleaseMutationVariables
+ OrderRelease,
+ OrderReleaseVariables
>;
orderUpdate: PartialMutationProviderOutput<
OrderUpdate,
@@ -77,12 +74,12 @@ interface OrderOperationsProps extends MutationProviderProps {
OrderShippingMethodUpdateVariables
>;
}>;
- onOrderFulfillmentCreate: (data: OrderCreateFulfillmentMutation) => void;
+ onOrderFulfillmentCreate: (data: OrderCreateFulfillment) => void;
onOrderCancel: (data: OrderCancel) => void;
- onOrderRelease: (data: OrderReleaseMutation) => void;
+ onOrderRelease: (data: OrderRelease) => void;
onNoteAdd: (data: OrderAddNote) => void;
- onPaymentCapture: (data: OrderCaptureMutation) => void;
- onPaymentRefund: (data: OrderRefundMutation) => void;
+ onPaymentCapture: (data: OrderCapture) => void;
+ onPaymentRefund: (data: OrderRefund) => void;
onUpdate: (data: OrderUpdate) => void;
onDraftUpdate: (data: OrderDraftUpdate) => void;
onShippingMethodUpdate: (data: OrderShippingMethodUpdate) => void;
@@ -149,7 +146,7 @@ const OrderOperations: React.StatelessComponent<OrderOperationsProps> = ({
...maybe(
() =>
createFulfillment.data
- .fulfillmentCreate.errors,
+ .orderFulfillmentCreate.errors,
[]
),
...maybe(
@@ -202,9 +199,9 @@ const OrderOperations: React.StatelessComponent<OrderOperationsProps> = ({
variables: {
...variables,
input: {
- ...variables.input,
- order
- }
+ ...variables.input
+ },
+ order
}
})
},
diff --git a/saleor/static/dashboard-next/orders/containers/OrderPaymentCapture.tsx b/saleor/static/dashboard-next/orders/containers/OrderPaymentCapture.tsx
index bc4cac3f19..9049a465dd 100644
--- a/saleor/static/dashboard-next/orders/containers/OrderPaymentCapture.tsx
+++ b/saleor/static/dashboard-next/orders/containers/OrderPaymentCapture.tsx
@@ -1,10 +1,7 @@
import * as React from "react";
-import {
- OrderCaptureMutation,
- OrderCaptureMutationVariables
-} from "../../gql-types";
import { TypedOrderCaptureMutation } from "../mutations";
+import { OrderCapture, OrderCaptureVariables } from "../types/OrderCapture";
import {
PartialMutationProviderProps,
@@ -12,11 +9,11 @@ import {
} from "../..";
interface OrderPaymentCaptureProviderProps
- extends PartialMutationProviderProps<OrderCaptureMutation> {
+ extends PartialMutationProviderProps<OrderCapture> {
id: string;
children: PartialMutationProviderRenderProps<
- OrderCaptureMutation,
- OrderCaptureMutationVariables
+ OrderCapture,
+ OrderCaptureVariables
>;
}
diff --git a/saleor/static/dashboard-next/orders/containers/OrderPaymentRefund.tsx b/saleor/static/dashboard-next/orders/containers/OrderPaymentRefund.tsx
index 62e2c72650..c4a9991dc9 100644
--- a/saleor/static/dashboard-next/orders/containers/OrderPaymentRefund.tsx
+++ b/saleor/static/dashboard-next/orders/containers/OrderPaymentRefund.tsx
@@ -1,10 +1,7 @@
import * as React from "react";
-import {
- OrderRefundMutation,
- OrderRefundMutationVariables
-} from "../../gql-types";
import { TypedOrderRefundMutation } from "../mutations";
+import { OrderRefund, OrderRefundVariables } from "../types/OrderRefund";
import {
PartialMutationProviderProps,
@@ -12,11 +9,11 @@ import {
} from "../..";
interface OrderPaymentCaptureProviderProps
- extends PartialMutationProviderProps<OrderRefundMutation> {
+ extends PartialMutationProviderProps<OrderRefund> {
id: string;
children: PartialMutationProviderRenderProps<
- OrderRefundMutation,
- OrderRefundMutationVariables
+ OrderRefund,
+ OrderRefundVariables
>;
}
diff --git a/saleor/static/dashboard-next/orders/containers/OrderRelease.tsx b/saleor/static/dashboard-next/orders/containers/OrderRelease.tsx
index b7440b8f55..c8c39a0771 100644
--- a/saleor/static/dashboard-next/orders/containers/OrderRelease.tsx
+++ b/saleor/static/dashboard-next/orders/containers/OrderRelease.tsx
@@ -1,10 +1,7 @@
import * as React from "react";
-import {
- OrderReleaseMutation,
- OrderReleaseMutationVariables
-} from "../../gql-types";
import { TypedOrderReleaseMutation } from "../mutations";
+import { OrderRelease, OrderReleaseVariables } from "../types/OrderRelease";
import {
PartialMutationProviderProps,
@@ -12,10 +9,10 @@ import {
} from "../..";
interface OrderReleaseMutationProviderProps
- extends PartialMutationProviderProps<OrderReleaseMutation> {
+ extends PartialMutationProviderProps<OrderRelease> {
children: PartialMutationProviderRenderProps<
- OrderReleaseMutation,
- OrderReleaseMutationVariables
+ OrderRelease,
+ OrderReleaseVariables
>;
}
diff --git a/saleor/static/dashboard-next/orders/mutations.ts b/saleor/static/dashboard-next/orders/mutations.ts
index be207f9448..6d7a0ad1f8 100644
--- a/saleor/static/dashboard-next/orders/mutations.ts
+++ b/saleor/static/dashboard-next/orders/mutations.ts
@@ -94,8 +94,11 @@ export const TypedOrderCaptureMutation = TypedMutation<
>(orderCaptureMutation);
const orderCreateFulfillmentMutation = gql`
- mutation OrderCreateFulfillment($input: FulfillmentCreateInput!) {
- orderFulfillmentCreate(input: $input) {
+ mutation OrderCreateFulfillment(
+ $order: ID!
+ $input: FulfillmentCreateInput!
+ ) {
+ orderFulfillmentCreate(order: $order, input: $input) {
errors {
field
message
diff --git a/saleor/static/dashboard-next/orders/types/OrderCreateFulfillment.ts b/saleor/static/dashboard-next/orders/types/OrderCreateFulfillment.ts
index 3fb53c5a75..68772238b2 100644
--- a/saleor/static/dashboard-next/orders/types/OrderCreateFulfillment.ts
+++ b/saleor/static/dashboard-next/orders/types/OrderCreateFulfillment.ts
@@ -23,5 +23,6 @@ export interface OrderCreateFulfillment {
}
export interface OrderCreateFulfillmentVariables {
+ order: string;
input: FulfillmentCreateInput;
}
diff --git a/saleor/static/dashboard-next/orders/views/OrderDetails.tsx b/saleor/static/dashboard-next/orders/views/OrderDetails.tsx
index fde8f416ec..0c2defd316 100644
--- a/saleor/static/dashboard-next/orders/views/OrderDetails.tsx
+++ b/saleor/static/dashboard-next/orders/views/OrderDetails.tsx
@@ -5,11 +5,6 @@ import { UserContext } from "../../auth";
import ErrorMessageCard from "../../components/ErrorMessageCard";
import Messages from "../../components/messages";
import Navigator from "../../components/Navigator";
-import {
- OrderCaptureMutation,
- OrderCreateFulfillmentMutation,
- OrderRefundMutation
-} from "../../gql-types";
import i18n from "../../i18n";
import { maybe } from "../../misc";
import { productUrl } from "../../products";
@@ -18,7 +13,10 @@ import OrderOperations from "../containers/OrderOperations";
import { OrderVariantSearchProvider } from "../containers/OrderVariantSearch";
import { TypedOrderDetailsQuery } from "../queries";
import { OrderAddNote } from "../types/OrderAddNote";
+import { OrderCapture } from "../types/OrderCapture";
+import { OrderCreateFulfillment } from "../types/OrderCreateFulfillment";
import { OrderDraftUpdate } from "../types/OrderDraftUpdate";
+import { OrderRefund } from "../types/OrderRefund";
import { OrderShippingMethodUpdate } from "../types/OrderShippingMethodUpdate";
import { OrderUpdate } from "../types/OrderUpdate";
@@ -44,9 +42,7 @@ export const OrderDetails: React.StatelessComponent<OrderDetailsProps> = ({
{({ user }) => (
<OrderVariantSearchProvider>
{({ variants: { search, searchOpts } }) => {
- const handlePaymentCapture = (
- data: OrderCaptureMutation
- ) => {
+ const handlePaymentCapture = (data: OrderCapture) => {
if (!maybe(() => data.orderCapture.errors.length)) {
pushMessage({
text: i18n.t("Payment succesfully captured", {
@@ -55,9 +51,7 @@ export const OrderDetails: React.StatelessComponent<OrderDetailsProps> = ({
});
}
};
- const handlePaymentRefund = (
- data: OrderRefundMutation
- ) => {
+ const handlePaymentRefund = (data: OrderRefund) => {
if (!maybe(() => data.orderRefund.errors.length)) {
pushMessage({
text: i18n.t("Payment succesfully refunded", {
@@ -67,11 +61,11 @@ export const OrderDetails: React.StatelessComponent<OrderDetailsProps> = ({
}
};
const handleOrderFulfillmentCreate = (
- data: OrderCreateFulfillmentMutation
+ data: OrderCreateFulfillment
) => {
if (
!maybe(
- () => data.OrderFulfillmentCreate.errors.length
+ () => data.orderFulfillmentCreate.errors.length
)
) {
pushMessage({
@@ -230,9 +224,9 @@ export const OrderDetails: React.StatelessComponent<OrderDetailsProps> = ({
.map((line, lineIndex) => ({
orderLineId: line.id,
quantity: variables.lines[lineIndex]
- })),
- order: order.id
- }
+ }))
+ },
+ order: order.id
})
}
onPaymentCapture={variables =>