Skip to content

Commit 0525eec

Browse files
authored
Shipping Labels: Add new entities for WooShippingShipment and Item (#15897)
2 parents 0ea5d32 + 91f1d8b commit 0525eec

15 files changed

+1333
-2
lines changed

Modules/Sources/Networking/Model/ShippingLabel/Shipments/WooShippingShipmentItem.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public struct WooShippingShipment: Equatable, GeneratedFakeable, GeneratedCopiab
3636
/// Represents a shipment item from the WooCommerce Shipping extension.
3737
///
3838
public struct WooShippingShipmentItem: Codable, Equatable, GeneratedFakeable, GeneratedCopiable {
39-
/// ID of the shipment
39+
/// ID of the order item
4040
public let id: Int64
4141

4242
/// Items of the shipment

Modules/Sources/Storage/Model/MIGRATIONS.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
This file documents changes in the WCiOS Storage data model. Please explain any changes to the data model as well as any custom migrations.
44

5+
## Model 124 (Release 22.9.0.0)
6+
- @itsmeichigo 2025-07-11
7+
- Added `WooShippingShipment` entity.
8+
- Added `WooShippingShipmentItem` entity.
9+
- Added `shipment` relationship to `ShippingLabel` entity.
10+
- Added `shipments` relationship to `Order` entity.
11+
512
## Model 123 (Release 22.8.0.0)
613
- @iamgabrielma 2025-06-30
714
- Added `createdVia` attribute to `Order` entity.

Modules/Sources/Storage/Model/Order+CoreDataProperties.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ extension Order {
7171
@NSManaged public var shippingLabelSettings: ShippingLabelSettings?
7272
@NSManaged public var taxes: Set<OrderTaxLine>?
7373
@NSManaged public var attributionInfo: OrderAttributionInfo?
74+
@NSManaged public var shipments: Set<WooShippingShipment>?
7475

7576
}
7677

@@ -277,3 +278,19 @@ extension Order {
277278
@NSManaged public func removeFromAppliedGiftCards(_ values: NSSet)
278279

279280
}
281+
282+
// MARK: Generated accessors for shipments
283+
extension Order {
284+
285+
@objc(addShipmentsObject:)
286+
@NSManaged public func addToShipments(_ value: WooShippingShipment)
287+
288+
@objc(removeShipmentsObject:)
289+
@NSManaged public func removeFromShipments(_ value: WooShippingShipment)
290+
291+
@objc(addShipments:)
292+
@NSManaged public func addToShipments(_ values: NSSet)
293+
294+
@objc(removeShipments:)
295+
@NSManaged public func removeFromShipments(_ values: NSSet)
296+
}

Modules/Sources/Storage/Model/ShippingLabel+CoreDataProperties.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ extension ShippingLabel {
2727
@NSManaged public var destinationAddress: ShippingLabelAddress?
2828
@NSManaged public var refund: ShippingLabelRefund?
2929
@NSManaged public var order: Order?
30+
@NSManaged public var shipment: WooShippingShipment?
3031
@NSManaged public var commercialInvoiceURL: String?
3132
@NSManaged public var usedDate: Date?
3233
@NSManaged public var expiryDate: Date?
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import Foundation
2+
import CoreData
3+
4+
@objc(WooShippingShipment)
5+
public class WooShippingShipment: NSManagedObject {
6+
7+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import Foundation
2+
import CoreData
3+
4+
extension WooShippingShipment {
5+
@nonobjc public class func fetchRequest() -> NSFetchRequest<WooShippingShipment> {
6+
return NSFetchRequest<WooShippingShipment>(entityName: "WooShippingShipment")
7+
}
8+
9+
@NSManaged public var siteID: Int64
10+
@NSManaged public var orderID: Int64
11+
@NSManaged public var index: String
12+
@NSManaged public var shippingLabel: ShippingLabel?
13+
@NSManaged public var items: Set<WooShippingShipmentItem>?
14+
@NSManaged public var order: Order?
15+
16+
}
17+
18+
// MARK: Generated accessors for items
19+
extension WooShippingShipment {
20+
21+
@objc(addItemsObject:)
22+
@NSManaged public func addToItems(_ value: WooShippingShipmentItem)
23+
24+
@objc(removeItemsObject:)
25+
@NSManaged public func removeFromItems(_ value: WooShippingShipmentItem)
26+
27+
@objc(addItems:)
28+
@NSManaged public func addToItems(_ values: NSSet)
29+
30+
@objc(removeItems:)
31+
@NSManaged public func removeFromItems(_ values: NSSet)
32+
33+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import Foundation
2+
import CoreData
3+
4+
@objc(WooShippingShipmentItem)
5+
public class WooShippingShipmentItem: NSManagedObject {
6+
7+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import Foundation
2+
import CoreData
3+
4+
extension WooShippingShipmentItem {
5+
6+
@nonobjc public class func fetchRequest() -> NSFetchRequest<WooShippingShipmentItem> {
7+
return NSFetchRequest<WooShippingShipmentItem>(entityName: "WooShippingShipmentItem")
8+
}
9+
10+
@NSManaged public var id: Int64
11+
@NSManaged public var subItems: NSArray?
12+
@NSManaged public var shipment: WooShippingShipment?
13+
14+
}

Modules/Sources/Storage/Resources/WooCommerce.xcdatamodeld/.xccurrentversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
<plist version="1.0">
44
<dict>
55
<key>_XCCurrentVersionName</key>
6-
<string>Model 123.xcdatamodel</string>
6+
<string>Model 124.xcdatamodel</string>
77
</dict>
88
</plist>

Modules/Sources/Storage/Resources/WooCommerce.xcdatamodeld/Model 124.xcdatamodel/contents

Lines changed: 1085 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)