Skip to content

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

Update customer details query

dominik-zeglencc977b569abf
diff --git a/saleor/static/dashboard-next/customers/fixtures.ts b/saleor/static/dashboard-next/customers/fixtures.ts
index b1dd3443a1..4cee15b2d5 100644
--- a/saleor/static/dashboard-next/customers/fixtures.ts
+++ b/saleor/static/dashboard-next/customers/fixtures.ts
@@ -1,4 +1,6 @@
import { ListCustomers_customers_edges_node } from "./types/ListCustomers";
+import { CustomerDetails_user } from "./types/CustomerDetails";
+import { PaymentStatusEnum } from "../types/globalTypes";
export const customers = [
{
@@ -674,7 +676,6 @@ export const customers = [
note: "Dolorem vitae."
}
];
-export const customer = customers[0];
export const customerList: ListCustomers_customers_edges_node[] = [
{
@@ -894,3 +895,83 @@ export const customerList: ListCustomers_customers_edges_node[] = [
}
}
];
+export const customer: CustomerDetails_user = {
+ __typename: "User",
+ defaultBillingAddress: {
+ __typename: "Address",
+ city: "Port Danielshire",
+ cityArea: "",
+ companyName: "",
+ country: {
+ __typename: "CountryDisplay",
+ code: "SE",
+ country: "Szwecja"
+ },
+ countryArea: "",
+ firstName: "Elizabeth",
+ id: "QWRkcmVzczoy",
+ lastName: "Vaughn",
+ phone: "",
+ postalCode: "52203",
+ streetAddress1: "419 Ruiz Orchard Apt. 199",
+ streetAddress2: ""
+ },
+ defaultShippingAddress: {
+ __typename: "Address",
+ city: "Port Danielshire",
+ cityArea: "",
+ companyName: "",
+ country: {
+ __typename: "CountryDisplay",
+ code: "SE",
+ country: "Szwecja"
+ },
+ countryArea: "",
+ firstName: "Elizabeth",
+ id: "QWRkcmVzczoy",
+ lastName: "Vaughn",
+ phone: "",
+ postalCode: "52203",
+ streetAddress1: "419 Ruiz Orchard Apt. 199",
+ streetAddress2: ""
+ },
+ email: "[email protected]",
+ id: "VXNlcjoy",
+ isActive: true,
+ lastPlacedOrder: {
+ __typename: "OrderCountableConnection",
+ edges: [
+ {
+ __typename: "OrderCountableEdge",
+ node: {
+ __typename: "Order",
+ created: "2018-09-11T09:37:30.124154+00:00",
+ id: "T3JkZXI6MTk="
+ }
+ }
+ ]
+ },
+ note: null,
+ orders: {
+ __typename: "OrderCountableConnection",
+ edges: [
+ {
+ __typename: "OrderCountableEdge",
+ node: {
+ __typename: "Order",
+ created: "2018-09-11T09:37:30.124154+00:00",
+ id: "T3JkZXI6MTk=",
+ paymentStatus: PaymentStatusEnum.CONFIRMED,
+ total: {
+ __typename: "TaxedMoney",
+ gross: {
+ __typename: "Money",
+ amount: 1215.89,
+ currency: "USD"
+ }
+ }
+ }
+ }
+ ]
+ }
+};
diff --git a/saleor/static/dashboard-next/customers/queries.ts b/saleor/static/dashboard-next/customers/queries.ts
index 769d93e400..1e380f0eae 100644
--- a/saleor/static/dashboard-next/customers/queries.ts
+++ b/saleor/static/dashboard-next/customers/queries.ts
@@ -41,33 +41,41 @@ export const TypedCustomerListQuery = TypedQuery<
const customerDetails = gql`
${fragmentAddress}
- query CustomerDetails($id: ID!, $lastOrders: Int!) {
+ query CustomerDetails($id: ID!) {
user(id: $id) {
- defaultBillingAddress {
+ id
+ email
+ defaultShippingAddress {
...AddressFragment
}
- defaultShippingAddress {
+ defaultBillingAddress {
...AddressFragment
}
- email
- id
- isActive
note
- orders(last: $lastOrders) {
+ isActive
+ orders(last: 5) {
edges {
node {
- created
id
- number
+ created
+ paymentStatus
total {
gross {
- amount
currency
+ amount
}
}
}
}
}
+ lastPlacedOrder: orders(last: 1) {
+ edges {
+ node {
+ id
+ created
+ }
+ }
+ }
}
}
`;
diff --git a/saleor/static/dashboard-next/customers/types/CustomerDetails.ts b/saleor/static/dashboard-next/customers/types/CustomerDetails.ts
index b42bdd59b0..ce974cc798 100644
--- a/saleor/static/dashboard-next/customers/types/CustomerDetails.ts
+++ b/saleor/static/dashboard-next/customers/types/CustomerDetails.ts
@@ -1,22 +1,24 @@
/* tslint:disable */
// This file was automatically generated and should not be edited.
+import { PaymentStatusEnum } from "./../../types/globalTypes";
+
// ====================================================
// GraphQL query operation: CustomerDetails
// ====================================================
-export interface CustomerDetails_user_defaultBillingAddress_country {
+export interface CustomerDetails_user_defaultShippingAddress_country {
__typename: "CountryDisplay";
code: string;
country: string;
}
-export interface CustomerDetails_user_defaultBillingAddress {
+export interface CustomerDetails_user_defaultShippingAddress {
__typename: "Address";
city: string;
cityArea: string;
companyName: string;
- country: CustomerDetails_user_defaultBillingAddress_country;
+ country: CustomerDetails_user_defaultShippingAddress_country;
countryArea: string;
firstName: string;
id: string;
@@ -27,18 +29,18 @@ export interface CustomerDetails_user_defaultBillingAddress {
streetAddress2: string;
}
-export interface CustomerDetails_user_defaultShippingAddress_country {
+export interface CustomerDetails_user_defaultBillingAddress_country {
__typename: "CountryDisplay";
code: string;
country: string;
}
-export interface CustomerDetails_user_defaultShippingAddress {
+export interface CustomerDetails_user_defaultBillingAddress {
__typename: "Address";
city: string;
cityArea: string;
companyName: string;
- country: CustomerDetails_user_defaultShippingAddress_country;
+ country: CustomerDetails_user_defaultBillingAddress_country;
countryArea: string;
firstName: string;
id: string;
@@ -51,8 +53,8 @@ export interface CustomerDetails_user_defaultShippingAddress {
export interface CustomerDetails_user_orders_edges_node_total_gross {
__typename: "Money";
- amount: number;
currency: string;
+ amount: number;
}
export interface CustomerDetails_user_orders_edges_node_total {
@@ -62,9 +64,9 @@ export interface CustomerDetails_user_orders_edges_node_total {
export interface CustomerDetails_user_orders_edges_node {
__typename: "Order";
- created: any;
id: string;
- number: string | null;
+ created: any;
+ paymentStatus: PaymentStatusEnum | null;
total: CustomerDetails_user_orders_edges_node_total | null;
}
@@ -78,15 +80,32 @@ export interface CustomerDetails_user_orders {
edges: CustomerDetails_user_orders_edges[];
}
+export interface CustomerDetails_user_lastPlacedOrder_edges_node {
+ __typename: "Order";
+ id: string;
+ created: any;
+}
+
+export interface CustomerDetails_user_lastPlacedOrder_edges {
+ __typename: "OrderCountableEdge";
+ node: CustomerDetails_user_lastPlacedOrder_edges_node;
+}
+
+export interface CustomerDetails_user_lastPlacedOrder {
+ __typename: "OrderCountableConnection";
+ edges: CustomerDetails_user_lastPlacedOrder_edges[];
+}
+
export interface CustomerDetails_user {
__typename: "User";
- defaultBillingAddress: CustomerDetails_user_defaultBillingAddress | null;
- defaultShippingAddress: CustomerDetails_user_defaultShippingAddress | null;
- email: string;
id: string;
- isActive: boolean;
+ email: string;
+ defaultShippingAddress: CustomerDetails_user_defaultShippingAddress | null;
+ defaultBillingAddress: CustomerDetails_user_defaultBillingAddress | null;
note: string | null;
+ isActive: boolean;
orders: CustomerDetails_user_orders | null;
+ lastPlacedOrder: CustomerDetails_user_lastPlacedOrder | null;
}
export interface CustomerDetails {
@@ -95,5 +114,4 @@ export interface CustomerDetails {
export interface CustomerDetailsVariables {
id: string;
- lastOrders: number;
}