To run this application, you must use the register-a-food-business-environment repository to set up your development environment.
It is recommended that you install the Prettier code-formatting extension for your IDE.
The following detailed guides are available:
- Starting and testing the application
- Adding a new data field
- The tech stack
- The email notifications code
- The GOV.UK email notifications service
- The FSA reference number generator
The /api/registration
route is the endpoint for creating, fetching, and deleting registrations.
A successful POST
request to the /createNewRegistration
route requires the following:
- A
POST
body inapplication/json
format, containing the registration data, in the data structure defined in validation.schema.js - Four
POST
headers:Content-Type
:application/json
client-name
: currently there is only one permitted client, the front-end application, and its name is stored in the environment variables for this service application.api-secret
: the corresponding secret forclient-name
.registration-data-version
: a string version number, in Semver format, to correlate with one of the entries in theconfigVersion
collection in the Config database.
A successful POST
request to the /createNewRegistration
route performs the following actions, in order:
- Saves the registration data to the
*-back-end-cache
database on Azure. This action means that any failed subsequent steps will be recoverable via a manual search of the cache database, rather than the user data being lost forever. - Validates the registration data against the schema
- Fetches the config details (such as contact details) for the specified district council and, optionally, its corresponding county council in cases where the county council manages food standards.
- Gets metadata for the registration. Currently, this is the unique food business registration application reference (via an Epimorphics API) and the registration date in
YYYY-MM-DD
format. - Sends a combined response object back to the client
- Performs a series of asynchronous post-response operations:
- Sends the registration to the Tascomi API specified in the config database for that council
- Saves the registration to the PostgreSQL database (
*-temp-store
) on Azure - Gets the config for the specified
registration-data-version
, which includes template IDs for GOV.UK Notify emails - Sends confirmation/notification emails to the Food Business Operator and Local Council(s) via GOV.UK Notify.
This route is primarily in place to allow easy actioning of GDPR deletion requests on individual registrations by the FSA registration application reference, or other required registration deletions. The client-name
and api-secret
headers are required to use this route. Note that the matching environment variables are the ADMIN_*
variables, which are different to those for the POST/createNewRegistration
route.
This route is deprecated because the collections service now provides all GET
functionality for saved registrations. However, the route can be used for admin purposes if necessary. The client-name
and api-secret
headers are required to use this route. Note that the matching environment variables are the ADMIN_*
variables, which are different to those for the POST/createNewRegistration
route.