Skip to content

Commit ea54d28

Browse files
committed
Storage: Removed separate address entity - merged fields into order
1 parent 9c5bc66 commit ea54d28

File tree

6 files changed

+129
-103
lines changed

6 files changed

+129
-103
lines changed

Storage/Storage.xcodeproj/project.pbxproj

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
7028A41485A08AC748206184 /* Pods_Storage.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DF3D3B298350F68191CD1DAD /* Pods_Storage.framework */; };
1212
7426A04720F68F27002A4E07 /* Order+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7426A04320F68F27002A4E07 /* Order+CoreDataClass.swift */; };
1313
7426A04820F68F27002A4E07 /* Order+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7426A04420F68F27002A4E07 /* Order+CoreDataProperties.swift */; };
14-
7426A04C20F697D5002A4E07 /* Address+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7426A04A20F697D5002A4E07 /* Address+CoreDataClass.swift */; };
15-
7426A04D20F697D5002A4E07 /* Address+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7426A04B20F697D5002A4E07 /* Address+CoreDataProperties.swift */; };
1614
7426A05020F69D00002A4E07 /* OrderCoupon+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7426A04E20F69D00002A4E07 /* OrderCoupon+CoreDataClass.swift */; };
1715
7426A05120F69D00002A4E07 /* OrderCoupon+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7426A04F20F69D00002A4E07 /* OrderCoupon+CoreDataProperties.swift */; };
1816
7426A05420F69DA4002A4E07 /* OrderItem+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7426A05220F69DA4002A4E07 /* OrderItem+CoreDataClass.swift */; };
@@ -56,8 +54,6 @@
5654
5D12CAE2D0EA6AB66F162FF9 /* Pods-StorageTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-StorageTests.debug.xcconfig"; path = "../Pods/Target Support Files/Pods-StorageTests/Pods-StorageTests.debug.xcconfig"; sourceTree = "<group>"; };
5755
7426A04320F68F27002A4E07 /* Order+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Order+CoreDataClass.swift"; sourceTree = "<group>"; };
5856
7426A04420F68F27002A4E07 /* Order+CoreDataProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Order+CoreDataProperties.swift"; sourceTree = "<group>"; };
59-
7426A04A20F697D5002A4E07 /* Address+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Address+CoreDataClass.swift"; sourceTree = "<group>"; };
60-
7426A04B20F697D5002A4E07 /* Address+CoreDataProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Address+CoreDataProperties.swift"; sourceTree = "<group>"; };
6157
7426A04E20F69D00002A4E07 /* OrderCoupon+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "OrderCoupon+CoreDataClass.swift"; sourceTree = "<group>"; };
6258
7426A04F20F69D00002A4E07 /* OrderCoupon+CoreDataProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "OrderCoupon+CoreDataProperties.swift"; sourceTree = "<group>"; };
6359
7426A05220F69DA4002A4E07 /* OrderItem+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "OrderItem+CoreDataClass.swift"; sourceTree = "<group>"; };
@@ -240,8 +236,6 @@
240236
B59E11D820A9D00C004121A4 /* WooCommerce.xcdatamodeld */,
241237
B505F6D920BEEA3200BB1B69 /* Account+CoreDataClass.swift */,
242238
B505F6D820BEEA3100BB1B69 /* Account+CoreDataProperties.swift */,
243-
7426A04A20F697D5002A4E07 /* Address+CoreDataClass.swift */,
244-
7426A04B20F697D5002A4E07 /* Address+CoreDataProperties.swift */,
245239
B5B914C320EFF03500F2F832 /* Site+CoreDataClass.swift */,
246240
B5B914C420EFF03500F2F832 /* Site+CoreDataProperties.swift */,
247241
7426A04320F68F27002A4E07 /* Order+CoreDataClass.swift */,
@@ -439,15 +433,13 @@
439433
B5B914C620EFF03500F2F832 /* Site+CoreDataProperties.swift in Sources */,
440434
7426A04820F68F27002A4E07 /* Order+CoreDataProperties.swift in Sources */,
441435
B505F6DB20BEEA3200BB1B69 /* Account+CoreDataClass.swift in Sources */,
442-
7426A04D20F697D5002A4E07 /* Address+CoreDataProperties.swift in Sources */,
443436
7426A05520F69DA4002A4E07 /* OrderItem+CoreDataProperties.swift in Sources */,
444437
7426A04720F68F27002A4E07 /* Order+CoreDataClass.swift in Sources */,
445438
B54CA5BD20A4BD3B00F38CD1 /* NSManagedObjectContext+Storage.swift in Sources */,
446439
B59E11DA20A9D00C004121A4 /* WooCommerce.xcdatamodeld in Sources */,
447440
B52B0F7920AA287C00477698 /* StorageManagerType.swift in Sources */,
448441
7426A05420F69DA4002A4E07 /* OrderItem+CoreDataClass.swift in Sources */,
449442
B505F6E020BEEA8100BB1B69 /* StorageType.swift in Sources */,
450-
7426A04C20F697D5002A4E07 /* Address+CoreDataClass.swift in Sources */,
451443
B54CA5C920A4C17800F38CD1 /* NSObject+Storage.swift in Sources */,
452444
B505F6DA20BEEA3200BB1B69 /* Account+CoreDataProperties.swift in Sources */,
453445
B505255420EE6914008090F5 /* StorageType+Extensions.swift in Sources */,

Storage/Storage/Model/Address+CoreDataClass.swift

Lines changed: 0 additions & 8 deletions
This file was deleted.

Storage/Storage/Model/Address+CoreDataProperties.swift

Lines changed: 0 additions & 24 deletions
This file was deleted.

Storage/Storage/Model/Order+CoreDataProperties.swift

Lines changed: 47 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,63 @@ extension Order {
88
return NSFetchRequest<Order>(entityName: "Order")
99
}
1010

11-
@NSManaged public var orderID: Int64
12-
@NSManaged public var parentID: Int64
13-
@NSManaged public var customerID: Int64
14-
@NSManaged public var number: String?
15-
@NSManaged public var status: String
1611
@NSManaged public var currency: String?
12+
@NSManaged public var customerID: Int64
1713
@NSManaged public var customerNote: String?
1814
@NSManaged public var dateCreated: Date?
1915
@NSManaged public var dateModified: Date?
2016
@NSManaged public var datePaid: Date?
21-
@NSManaged public var discountTotal: String?
2217
@NSManaged public var discountTax: String?
23-
@NSManaged public var shippingTotal: String?
18+
@NSManaged public var discountTotal: String?
19+
@NSManaged public var number: String?
20+
@NSManaged public var orderID: Int64
21+
@NSManaged public var parentID: Int64
22+
@NSManaged public var paymentMethodTitle: String?
2423
@NSManaged public var shippingTax: String?
24+
@NSManaged public var shippingTotal: String?
25+
@NSManaged public var status: String
2526
@NSManaged public var total: String?
2627
@NSManaged public var totalTax: String?
27-
@NSManaged public var paymentMethodTitle: String?
28-
@NSManaged public var items: NSSet?
29-
@NSManaged public var billingAddress: Address?
30-
@NSManaged public var shippingAddress: Address?
28+
@NSManaged public var billingFirstName: String?
29+
@NSManaged public var billingLastName: String?
30+
@NSManaged public var billingCountry: String?
31+
@NSManaged public var billingPostcode: String?
32+
@NSManaged public var billingState: String?
33+
@NSManaged public var billingCity: String?
34+
@NSManaged public var billingAddress2: String?
35+
@NSManaged public var billingAddress1: String?
36+
@NSManaged public var billingCompany: String?
37+
@NSManaged public var billingPhone: String?
38+
@NSManaged public var billingEmail: String?
39+
@NSManaged public var shippingFirstName: String?
40+
@NSManaged public var shippingLastName: String?
41+
@NSManaged public var shippingCompany: String?
42+
@NSManaged public var shippingAddress1: String?
43+
@NSManaged public var shippingAddress2: String?
44+
@NSManaged public var shippingCity: String?
45+
@NSManaged public var shippingPostcode: String?
46+
@NSManaged public var shippingCountry: String?
47+
@NSManaged public var shippingPhone: String?
48+
@NSManaged public var shippingEmail: String?
49+
@NSManaged public var shippingState: String?
3150
@NSManaged public var coupons: NSSet?
51+
@NSManaged public var items: NSSet?
52+
}
53+
54+
// MARK: Generated accessors for coupons
55+
extension Order {
56+
57+
@objc(addCouponsObject:)
58+
@NSManaged public func addToCoupons(_ value: OrderCoupon)
59+
60+
@objc(removeCouponsObject:)
61+
@NSManaged public func removeFromCoupons(_ value: OrderCoupon)
62+
63+
@objc(addCoupons:)
64+
@NSManaged public func addToCoupons(_ values: NSSet)
65+
66+
@objc(removeCoupons:)
67+
@NSManaged public func removeFromCoupons(_ values: NSSet)
3268

3369
}
3470

@@ -48,20 +84,3 @@ extension Order {
4884
@NSManaged public func removeFromItems(_ values: NSSet)
4985

5086
}
51-
52-
// MARK: Generated accessors for coupons
53-
extension Order {
54-
55-
@objc(addCouponsObject:)
56-
@NSManaged public func addToCoupons(_ value: OrderCoupon)
57-
58-
@objc(removeCouponsObject:)
59-
@NSManaged public func removeFromCoupons(_ value: OrderCoupon)
60-
61-
@objc(addCoupons:)
62-
@NSManaged public func addToCoupons(_ values: NSSet)
63-
64-
@objc(removeCoupons:)
65-
@NSManaged public func removeFromCoupons(_ values: NSSet)
66-
67-
}

Storage/Storage/Model/WooCommerce.xcdatamodeld/Model.xcdatamodel/contents

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,18 @@
77
<attribute name="userID" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
88
<attribute name="username" attributeType="String" syncable="YES"/>
99
</entity>
10-
<entity name="Address" representedClassName="Address" syncable="YES">
11-
<attribute name="address1" optional="YES" attributeType="String" syncable="YES"/>
12-
<attribute name="address2" optional="YES" attributeType="String" syncable="YES"/>
13-
<attribute name="city" optional="YES" attributeType="String" syncable="YES"/>
14-
<attribute name="company" optional="YES" attributeType="String" syncable="YES"/>
15-
<attribute name="country" optional="YES" attributeType="String" syncable="YES"/>
16-
<attribute name="email" optional="YES" attributeType="String" syncable="YES"/>
17-
<attribute name="firstName" optional="YES" attributeType="String" syncable="YES"/>
18-
<attribute name="lastName" optional="YES" attributeType="String" syncable="YES"/>
19-
<attribute name="phone" optional="YES" attributeType="String" syncable="YES"/>
20-
<attribute name="postcode" optional="YES" attributeType="String" syncable="YES"/>
21-
<attribute name="state" optional="YES" attributeType="String" syncable="YES"/>
22-
<relationship name="billingOrder" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Order" inverseName="billingAddress" inverseEntity="Order" syncable="YES"/>
23-
<relationship name="shippingOrder" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Order" inverseName="shippingAddress" inverseEntity="Order" syncable="YES"/>
24-
</entity>
2510
<entity name="Order" representedClassName="Order" syncable="YES">
11+
<attribute name="billingAddress1" optional="YES" attributeType="String" syncable="YES"/>
12+
<attribute name="billingAddress2" optional="YES" attributeType="String" syncable="YES"/>
13+
<attribute name="billingCity" optional="YES" attributeType="String" syncable="YES"/>
14+
<attribute name="billingCompany" optional="YES" attributeType="String" syncable="YES"/>
15+
<attribute name="billingCountry" optional="YES" attributeType="String" syncable="YES"/>
16+
<attribute name="billingEmail" optional="YES" attributeType="String" syncable="YES"/>
17+
<attribute name="billingFirstName" optional="YES" attributeType="String" syncable="YES"/>
18+
<attribute name="billingLastName" optional="YES" attributeType="String" syncable="YES"/>
19+
<attribute name="billingPhone" optional="YES" attributeType="String" syncable="YES"/>
20+
<attribute name="billingPostcode" optional="YES" attributeType="String" syncable="YES"/>
21+
<attribute name="billingState" optional="YES" attributeType="String" syncable="YES"/>
2622
<attribute name="currency" optional="YES" attributeType="String" syncable="YES"/>
2723
<attribute name="customerID" optional="YES" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
2824
<attribute name="customerNote" optional="YES" attributeType="String" syncable="YES"/>
@@ -35,15 +31,24 @@
3531
<attribute name="orderID" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
3632
<attribute name="parentID" optional="YES" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
3733
<attribute name="paymentMethodTitle" optional="YES" attributeType="String" syncable="YES"/>
34+
<attribute name="shippingAddress1" optional="YES" attributeType="String" syncable="YES"/>
35+
<attribute name="shippingAddress2" optional="YES" attributeType="String" syncable="YES"/>
36+
<attribute name="shippingCity" optional="YES" attributeType="String" syncable="YES"/>
37+
<attribute name="shippingCompany" optional="YES" attributeType="String" syncable="YES"/>
38+
<attribute name="shippingCountry" optional="YES" attributeType="String" syncable="YES"/>
39+
<attribute name="shippingEmail" optional="YES" attributeType="String" syncable="YES"/>
40+
<attribute name="shippingFirstName" optional="YES" attributeType="String" syncable="YES"/>
41+
<attribute name="shippingLastName" optional="YES" attributeType="String" syncable="YES"/>
42+
<attribute name="shippingPhone" optional="YES" attributeType="String" syncable="YES"/>
43+
<attribute name="shippingPostcode" optional="YES" attributeType="String" syncable="YES"/>
44+
<attribute name="shippingState" optional="YES" attributeType="String" syncable="YES"/>
3845
<attribute name="shippingTax" optional="YES" attributeType="String" syncable="YES"/>
3946
<attribute name="shippingTotal" optional="YES" attributeType="String" syncable="YES"/>
4047
<attribute name="status" attributeType="String" syncable="YES"/>
4148
<attribute name="total" optional="YES" attributeType="String" syncable="YES"/>
4249
<attribute name="totalTax" optional="YES" attributeType="String" syncable="YES"/>
43-
<relationship name="billingAddress" optional="YES" maxCount="1" deletionRule="Cascade" destinationEntity="Address" inverseName="billingOrder" inverseEntity="Address" syncable="YES"/>
4450
<relationship name="coupons" optional="YES" toMany="YES" deletionRule="Cascade" destinationEntity="OrderCoupon" inverseName="order" inverseEntity="OrderCoupon" syncable="YES"/>
4551
<relationship name="items" optional="YES" toMany="YES" deletionRule="Cascade" destinationEntity="OrderItem" inverseName="order" inverseEntity="OrderItem" syncable="YES"/>
46-
<relationship name="shippingAddress" optional="YES" maxCount="1" deletionRule="Cascade" destinationEntity="Address" inverseName="shippingOrder" inverseEntity="Address" syncable="YES"/>
4752
</entity>
4853
<entity name="OrderCoupon" representedClassName="OrderCoupon" syncable="YES">
4954
<attribute name="code" optional="YES" attributeType="String" syncable="YES"/>
@@ -75,8 +80,7 @@
7580
</entity>
7681
<elements>
7782
<element name="Account" positionX="-218" positionY="132" width="128" height="120"/>
78-
<element name="Address" positionX="259" positionY="381" width="128" height="240"/>
79-
<element name="Order" positionX="-45" positionY="54" width="128" height="360"/>
83+
<element name="Order" positionX="-45" positionY="54" width="128" height="660"/>
8084
<element name="OrderCoupon" positionX="18" positionY="234" width="128" height="120"/>
8185
<element name="OrderItem" positionX="216" positionY="72" width="128" height="223"/>
8286
<element name="Site" positionX="-216" positionY="285" width="128" height="120"/>

0 commit comments

Comments
 (0)