Skip to content

Commit 3d560e1

Browse files
committed
Extract POSItemIdentifier to its own file
This prevents the generated code from importing PagedItems from networking.
1 parent 749c49f commit 3d560e1

File tree

2 files changed

+21
-20
lines changed

2 files changed

+21
-20
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import Foundation
2+
import Codegen
3+
4+
public struct POSItemIdentifier: Hashable, Sendable, GeneratedCopiable, GeneratedFakeable {
5+
public let underlyingType: UnderlyingType
6+
public let itemID: Int64
7+
8+
public init(underlyingType: UnderlyingType, itemID: Int64) {
9+
self.underlyingType = underlyingType
10+
self.itemID = itemID
11+
}
12+
13+
public enum UnderlyingType: Sendable, GeneratedCopiable, GeneratedFakeable {
14+
case product
15+
case variation
16+
case coupon
17+
case loading
18+
case error
19+
}
20+
}

Modules/Sources/Yosemite/PointOfSale/Items/PointOfSaleItemServiceProtocol.swift

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import Foundation
2-
import Networking
3-
import Codegen
2+
import struct Networking.PagedItems
43

54
public enum POSItem: Equatable, Identifiable, Hashable {
65
case simpleProduct(POSSimpleProduct)
@@ -22,24 +21,6 @@ public enum POSItem: Equatable, Identifiable, Hashable {
2221
}
2322
}
2423

25-
public struct POSItemIdentifier: Hashable, Sendable, GeneratedCopiable, GeneratedFakeable {
26-
public let underlyingType: UnderlyingType
27-
public let itemID: Int64
28-
29-
public init(underlyingType: UnderlyingType, itemID: Int64) {
30-
self.underlyingType = underlyingType
31-
self.itemID = itemID
32-
}
33-
34-
public enum UnderlyingType: Sendable, GeneratedCopiable, GeneratedFakeable {
35-
case product
36-
case variation
37-
case coupon
38-
case loading
39-
case error
40-
}
41-
}
42-
4324
/// POSOrderableItem extends a displayable item with the functions required for using it in an order.
4425
/// This currently includes adding it, and checking whether it's already in an order.
4526
/// This may need to become less specific in future, e.g. we currently convert it to a product input, but

0 commit comments

Comments
 (0)