Skip to content

Commit 9aee94a

Browse files
authored
Merge branch 'trunk' into issue/woomob-1314-woo-poslocal-catalog-add-ios-remote-feature-flag-support
2 parents 67b363a + 92918d7 commit 9aee94a

File tree

28 files changed

+1827
-78
lines changed

28 files changed

+1827
-78
lines changed

Modules/Sources/Fakes/Networking.generated.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,8 @@ extension Networking.Booking {
343343
attendanceStatusKey: .fake(),
344344
localTimezone: .fake(),
345345
currency: .fake(),
346-
orderInfo: .fake()
346+
orderInfo: .fake(),
347+
note: .fake()
347348
)
348349
}
349350
}

Modules/Sources/Networking/Model/Bookings/Booking.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public struct Booking: Codable, GeneratedCopiable, Hashable, GeneratedFakeable {
2424
public let localTimezone: String
2525
public let currency: String
2626
public let orderInfo: BookingOrderInfo?
27+
public let note: String
2728

2829
public var bookingStatus: BookingStatus {
2930
return BookingStatus(rawValue: statusKey) ?? .unknown
@@ -54,7 +55,8 @@ public struct Booking: Codable, GeneratedCopiable, Hashable, GeneratedFakeable {
5455
attendanceStatusKey: String,
5556
localTimezone: String,
5657
currency: String,
57-
orderInfo: BookingOrderInfo?) {
58+
orderInfo: BookingOrderInfo?,
59+
note: String) {
5860
self.siteID = siteID
5961
self.bookingID = bookingID
6062
self.allDay = allDay
@@ -75,6 +77,7 @@ public struct Booking: Codable, GeneratedCopiable, Hashable, GeneratedFakeable {
7577
self.localTimezone = localTimezone
7678
self.currency = currency
7779
self.orderInfo = orderInfo
80+
self.note = note
7881
}
7982

8083
/// The public initializer for Booking.
@@ -129,6 +132,7 @@ public struct Booking: Codable, GeneratedCopiable, Hashable, GeneratedFakeable {
129132
let localTimezone = try container.decode(String.self, forKey: .localTimezone)
130133
let currency = try container.decode(String.self, forKey: .currency)
131134
let orderInfo: BookingOrderInfo? = nil // to be prefilled when synced
135+
let note = try container.decode(String.self, forKey: .note)
132136

133137
self.init(siteID: siteID,
134138
bookingID: bookingID,
@@ -149,7 +153,8 @@ public struct Booking: Codable, GeneratedCopiable, Hashable, GeneratedFakeable {
149153
attendanceStatusKey: attendanceStatusKey,
150154
localTimezone: localTimezone,
151155
currency: currency,
152-
orderInfo: orderInfo)
156+
orderInfo: orderInfo,
157+
note: note)
153158
}
154159

155160
public func encode(to encoder: Encoder) throws {
@@ -203,6 +208,7 @@ private extension Booking {
203208
case attendanceStatusKey = "attendance_status"
204209
case localTimezone = "local_timezone"
205210
case currency
211+
case note
206212
}
207213
}
208214

Modules/Sources/Networking/Model/Copiable/Models+Copiable.generated.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,8 @@ extension Networking.Booking {
450450
attendanceStatusKey: CopiableProp<String> = .copy,
451451
localTimezone: CopiableProp<String> = .copy,
452452
currency: CopiableProp<String> = .copy,
453-
orderInfo: NullableCopiableProp<BookingOrderInfo> = .copy
453+
orderInfo: NullableCopiableProp<BookingOrderInfo> = .copy,
454+
note: CopiableProp<String> = .copy
454455
) -> Networking.Booking {
455456
let siteID = siteID ?? self.siteID
456457
let bookingID = bookingID ?? self.bookingID
@@ -472,6 +473,7 @@ extension Networking.Booking {
472473
let localTimezone = localTimezone ?? self.localTimezone
473474
let currency = currency ?? self.currency
474475
let orderInfo = orderInfo ?? self.orderInfo
476+
let note = note ?? self.note
475477

476478
return Networking.Booking(
477479
siteID: siteID,
@@ -493,7 +495,8 @@ extension Networking.Booking {
493495
attendanceStatusKey: attendanceStatusKey,
494496
localTimezone: localTimezone,
495497
currency: currency,
496-
orderInfo: orderInfo
498+
orderInfo: orderInfo,
499+
note: note
497500
)
498501
}
499502
}

Modules/Sources/Networking/Remote/BookingsRemote.swift

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ public protocol BookingsRemoteProtocol {
1919
func updateBooking(
2020
from siteID: Int64,
2121
bookingID: Int64,
22-
attendanceStatus: BookingAttendanceStatus
22+
attendanceStatus: BookingAttendanceStatus?,
23+
bookingStatus: BookingStatus?
2324
) async throws -> Booking?
2425

2526
func fetchResource(resourceID: Int64,
@@ -150,12 +151,20 @@ public final class BookingsRemote: Remote, BookingsRemoteProtocol {
150151
public func updateBooking(
151152
from siteID: Int64,
152153
bookingID: Int64,
153-
attendanceStatus: BookingAttendanceStatus
154+
attendanceStatus: BookingAttendanceStatus?,
155+
bookingStatus: BookingStatus?
154156
) async throws -> Booking? {
155157
let path = "\(Path.bookings)/\(bookingID)"
156-
let parameters = [
157-
ParameterKey.attendanceStatus: attendanceStatus.rawValue
158-
]
158+
var parameters: [String: String] = [:]
159+
160+
if let attendanceStatus {
161+
parameters[ParameterKey.attendanceStatus] = attendanceStatus.rawValue
162+
}
163+
164+
if let bookingStatus {
165+
parameters[ParameterKey.status] = bookingStatus.rawValue
166+
}
167+
159168
let request = JetpackRequest(
160169
wooApiVersion: .wcBookings,
161170
method: .put,
@@ -249,5 +258,6 @@ public extension BookingsRemote {
249258
static let resource: String = "resource"
250259
static let bookingStatus: String = "booking_status"
251260
static let attendanceStatus = "attendance_status"
261+
static let status: String = "status"
252262
}
253263
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ extension Booking {
2323
@NSManaged public var localTimezone: String?
2424
@NSManaged public var currency: String?
2525
@NSManaged public var orderInfo: BookingOrderInfo?
26+
@NSManaged public var note: String?
2627
}

Modules/Sources/Storage/Model/MIGRATIONS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
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 130 (Release 23.7)
6+
- @adborbas 2025-11-06
7+
- Added `note` attribute to `Booking` entity.
8+
59
## Model 129 (Release X.X.X.X)
610
- @rafaelkayumov 2025-10-17
711
- Added `attendanceStatusKey` attribute to `Booking` entity.

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 129.xcdatamodel</string>
6+
<string>Model 130.xcdatamodel</string>
77
</dict>
88
</plist>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2-
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="24299" systemVersion="24G90" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
2+
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="24299" systemVersion="25A362" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
33
<entity name="Account" representedClassName="Account" syncable="YES">
44
<attribute name="displayName" optional="YES" attributeType="String"/>
55
<attribute name="email" optional="YES" attributeType="String"/>

0 commit comments

Comments
 (0)