Created
May 2, 2019 09:13
-
-
Save godrm/b1fa9660a0df0c3799678545e7080f41 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CustomOrderRequest { | |
private (set) var products = [Product]() | |
} | |
protocol OrderCommand { | |
// | |
} | |
protocol OrderManagerProtocol { | |
func send(command : OrderCommand) | |
} | |
class AddCustomerOrderCommand : OrderCommand { | |
private var id : UUID | |
private var products = [Product]() | |
init(id: UUID, products: [Product]) { | |
self.id = id | |
self.products.append(contentsOf: products) | |
} | |
} | |
class CustomerOrderController { | |
private (set) var orderManager : OrderManagerProtocol | |
init(manager: OrderManagerProtocol) { | |
self.orderManager = manager | |
} | |
func addCustomerOrderCommand(customerId : UUID, request: CustomOrderRequest) { | |
orderManager.send(command: AddCustomerOrderCommand(id: customerId, products: request.products)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment