Writing the ProcessingController

The ProcessingController is an internal-only controller. It will be used for performing actions with orders that the user has no input into.

Follow these steps to create our controller:

  1. Open Sources/App/Controllers, create a ProcessingController.swift file, and enter the following content into the file:
import Fluentimport Vaporfinal class ProcessingController {}

This code is only the container for the class. We will need the following three functions:

  • getOrders: This returns a list of orders based on a status.
  • processOrderInformation: This checks the prices of an order according to the PMS.
  • getProductInformation: This returns the prices from the PMS.
  1. Create the three function templates:
func getOrders(status: ...

Get Hands-On Swift 5 Microservices Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.