Browse Source

feat: Simplify Order address type

Michael Bromley 7 years ago
parent
commit
cdd28f548e

+ 1 - 1
admin-ui/src/app/data/definitions/order-definitions.ts

@@ -10,7 +10,7 @@ export const ADJUSTMENT_FRAGMENT = gql`
 `;
 
 export const SHIPPING_ADDRESS_FRAGMENT = gql`
-    fragment ShippingAddress on ShippingAddress {
+    fragment ShippingAddress on OrderAddress {
         fullName
         company
         streetLine1

File diff suppressed because it is too large
+ 0 - 0
schema.json


+ 3 - 9
server/src/entity/order/order.entity.ts

@@ -1,12 +1,6 @@
 import { Column, Entity, JoinTable, ManyToMany, ManyToOne, OneToMany } from 'typeorm';
 
-import {
-    Adjustment,
-    AdjustmentType,
-    BillingAddress,
-    CurrencyCode,
-    ShippingAddress,
-} from '../../../../shared/generated-types';
+import { Adjustment, AdjustmentType, CurrencyCode, OrderAddress } from '../../../../shared/generated-types';
 import { DeepPartial, ID } from '../../../../shared/shared-types';
 import { Calculated } from '../../common/calculated-decorator';
 import { idType } from '../../config/config-helpers';
@@ -53,9 +47,9 @@ export class Order extends VendureEntity {
 
     @Column('simple-json') pendingAdjustments: Adjustment[];
 
-    @Column('simple-json') shippingAddress: ShippingAddress;
+    @Column('simple-json') shippingAddress: OrderAddress;
 
-    @Column('simple-json') billingAddress: BillingAddress;
+    @Column('simple-json') billingAddress: OrderAddress;
 
     @OneToMany(type => Payment, payment => payment.order)
     payments: Payment[];

+ 3 - 16
server/src/entity/order/order.graphql

@@ -6,8 +6,8 @@ type Order implements Node {
     state: String!
     active: Boolean!
     customer: Customer
-    shippingAddress: ShippingAddress
-    billingAddress: BillingAddress
+    shippingAddress: OrderAddress
+    billingAddress: OrderAddress
     lines: [OrderLine!]!
     adjustments: [Adjustment!]!
     payments: [Payment!]
@@ -20,20 +20,7 @@ type Order implements Node {
     total: Int!
 }
 
-type ShippingAddress {
-    fullName: String
-    company: String
-    streetLine1: String
-    streetLine2: String
-    city: String
-    province: String
-    postalCode: String
-    country: String
-    countryCode: String
-    phoneNumber: String
-}
-
-type BillingAddress {
+type OrderAddress {
     fullName: String
     company: String
     streetLine1: String

+ 5 - 29
shared/generated-types.ts

@@ -1,5 +1,5 @@
 // tslint:disable
-// Generated in 2019-02-15T09:00:52+01:00
+// Generated in 2019-02-18T13:01:33+01:00
 export type Maybe<T> = T | null;
 
 
@@ -3628,7 +3628,7 @@ export namespace Adjustment {
 
 export namespace ShippingAddress {
   export type Fragment = {
-    __typename?: "ShippingAddress";
+    __typename?: "OrderAddress";
     
     fullName: Maybe<string>;
     
@@ -4799,9 +4799,9 @@ export interface Order extends Node {
   
   customer?: Maybe<Customer>;
   
-  shippingAddress?: Maybe<ShippingAddress>;
+  shippingAddress?: Maybe<OrderAddress>;
   
-  billingAddress?: Maybe<BillingAddress>;
+  billingAddress?: Maybe<OrderAddress>;
   
   lines: OrderLine[];
   
@@ -4825,31 +4825,7 @@ export interface Order extends Node {
 }
 
 
-export interface ShippingAddress {
-  
-  fullName?: Maybe<string>;
-  
-  company?: Maybe<string>;
-  
-  streetLine1?: Maybe<string>;
-  
-  streetLine2?: Maybe<string>;
-  
-  city?: Maybe<string>;
-  
-  province?: Maybe<string>;
-  
-  postalCode?: Maybe<string>;
-  
-  country?: Maybe<string>;
-  
-  countryCode?: Maybe<string>;
-  
-  phoneNumber?: Maybe<string>;
-}
-
-
-export interface BillingAddress {
+export interface OrderAddress {
   
   fullName?: Maybe<string>;
   

Some files were not shown because too many files changed in this diff