The input models will take in all the information we need to process a request. We only need three models:
- AddressInput: When passing along address information.
- NewUserInput: When registering a new user.
- EditUserInput: When editing an existing user.
- LoginInput: When logging in.
Go through the following steps to create the models:
- Create an AddressInput.swift file in Sources/App/Models/Inputs/ and insert the first model, as follows:
import Vaporstruct AddressInput: Content { let street: String let city: String let zip: String}
The model only reflects the properties that we need from the model. It conforms to the Content protocol.
- Create a new NewUserInput.swift file, as follows:
import Vaporstruct NewUserInput: Content ...