In this service, we need to store the incoming orders in the database. The models we are creating in this section are representing that information in Swift through Fluent. Additionally, we also need to create input and output models that help us transfer the information from and to the user.
We have the following models to consider:
- Order: This represents the order from a consumer.
- OrderItem: This is an item within an order.
- OrderPayment: This is a payment posted for an order.
When it comes to payments, make sure you always provide enough flexibility for different payment types and amounts. People are usually not as well-versed as we would like them to be for our services.
Let's go through the following sections:
- Configuring database models: Creating the models that correspond with the database.
- Writing input models: All our inputs put into structs...