Explorar o código

feat(server): Add billingAddress property to Order entity

Michael Bromley %!s(int64=7) %!d(string=hai) anos
pai
achega
108f06eab1

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
schema.json


+ 8 - 1
server/src/entity/order/order.entity.ts

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

+ 13 - 0
server/src/entity/order/order.graphql

@@ -7,6 +7,7 @@ type Order implements Node {
     active: Boolean!
     customer: Customer
     shippingAddress: ShippingAddress
+    billingAddress: BillingAddress
     lines: [OrderLine!]!
     adjustments: [Adjustment!]!
     payments: [Payment!]
@@ -29,3 +30,15 @@ type ShippingAddress {
     country: String
     phoneNumber: String
 }
+
+type BillingAddress {
+    fullName: String
+    company: String
+    streetLine1: String
+    streetLine2: String
+    city: String
+    province: String
+    postalCode: String
+    country: String
+    phoneNumber: String
+}

+ 1 - 0
server/src/service/services/order.service.ts

@@ -115,6 +115,7 @@ export class OrderService {
             state: this.orderStateMachine.getInitialState(),
             lines: [],
             shippingAddress: {},
+            billingAddress: {},
             pendingAdjustments: [],
             subTotal: 0,
             subTotalBeforeTax: 0,

+ 75 - 0
shared/generated-types.ts

@@ -296,6 +296,7 @@ export interface Order extends Node {
     active: boolean;
     customer?: Customer | null;
     shippingAddress?: ShippingAddress | null;
+    billingAddress?: BillingAddress | null;
     lines: OrderLine[];
     adjustments: Adjustment[];
     payments?: Payment[] | null;
@@ -319,6 +320,18 @@ export interface ShippingAddress {
     phoneNumber?: string | null;
 }
 
+export interface BillingAddress {
+    fullName?: string | null;
+    company?: string | null;
+    streetLine1?: string | null;
+    streetLine2?: string | null;
+    city?: string | null;
+    province?: string | null;
+    postalCode?: string | null;
+    country?: string | null;
+    phoneNumber?: string | null;
+}
+
 export interface OrderLine extends Node {
     id: string;
     createdAt: DateTime;
@@ -3012,6 +3025,7 @@ export namespace OrderResolvers {
         active?: ActiveResolver<boolean, any, Context>;
         customer?: CustomerResolver<Customer | null, any, Context>;
         shippingAddress?: ShippingAddressResolver<ShippingAddress | null, any, Context>;
+        billingAddress?: BillingAddressResolver<BillingAddress | null, any, Context>;
         lines?: LinesResolver<OrderLine[], any, Context>;
         adjustments?: AdjustmentsResolver<Adjustment[], any, Context>;
         payments?: PaymentsResolver<Payment[] | null, any, Context>;
@@ -3039,6 +3053,11 @@ export namespace OrderResolvers {
         Parent,
         Context
     >;
+    export type BillingAddressResolver<R = BillingAddress | null, Parent = any, Context = any> = Resolver<
+        R,
+        Parent,
+        Context
+    >;
     export type LinesResolver<R = OrderLine[], Parent = any, Context = any> = Resolver<R, Parent, Context>;
     export type AdjustmentsResolver<R = Adjustment[], Parent = any, Context = any> = Resolver<
         R,
@@ -3126,6 +3145,62 @@ export namespace ShippingAddressResolvers {
     >;
 }
 
+export namespace BillingAddressResolvers {
+    export interface Resolvers<Context = any> {
+        fullName?: FullNameResolver<string | null, any, Context>;
+        company?: CompanyResolver<string | null, any, Context>;
+        streetLine1?: StreetLine1Resolver<string | null, any, Context>;
+        streetLine2?: StreetLine2Resolver<string | null, any, Context>;
+        city?: CityResolver<string | null, any, Context>;
+        province?: ProvinceResolver<string | null, any, Context>;
+        postalCode?: PostalCodeResolver<string | null, any, Context>;
+        country?: CountryResolver<string | null, any, Context>;
+        phoneNumber?: PhoneNumberResolver<string | null, any, Context>;
+    }
+
+    export type FullNameResolver<R = string | null, Parent = any, Context = any> = Resolver<
+        R,
+        Parent,
+        Context
+    >;
+    export type CompanyResolver<R = string | null, Parent = any, Context = any> = Resolver<
+        R,
+        Parent,
+        Context
+    >;
+    export type StreetLine1Resolver<R = string | null, Parent = any, Context = any> = Resolver<
+        R,
+        Parent,
+        Context
+    >;
+    export type StreetLine2Resolver<R = string | null, Parent = any, Context = any> = Resolver<
+        R,
+        Parent,
+        Context
+    >;
+    export type CityResolver<R = string | null, Parent = any, Context = any> = Resolver<R, Parent, Context>;
+    export type ProvinceResolver<R = string | null, Parent = any, Context = any> = Resolver<
+        R,
+        Parent,
+        Context
+    >;
+    export type PostalCodeResolver<R = string | null, Parent = any, Context = any> = Resolver<
+        R,
+        Parent,
+        Context
+    >;
+    export type CountryResolver<R = string | null, Parent = any, Context = any> = Resolver<
+        R,
+        Parent,
+        Context
+    >;
+    export type PhoneNumberResolver<R = string | null, Parent = any, Context = any> = Resolver<
+        R,
+        Parent,
+        Context
+    >;
+}
+
 export namespace OrderLineResolvers {
     export interface Resolvers<Context = any> {
         id?: IdResolver<string, any, Context>;

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio