This repository contains a working web service application for Pinfold. Your task is to refactor this application using the functional programming principles discussed during the course. Furthermore, you will implement additional use cases.
The application currently models pins and pinneries
A pinnery produces pins. Each pinnery
- has a *unique *name that is not empty,
- and has a location. Valid locations are the fictive places of
- Ankh-Morpork
- Quirm
- Genua
- Omnia
- Lancre
- Uberwald
A pin
- has a unique name that is not empty,
- a value in dollars that cannot be below zero,
- and was produced by a known pinnery
- The application starts in the
main
function. - The function
configureApp
registers the routes defined inWeb.fs
. - The function
configureServices
registers the data store and JSON-library Thoth that are used by the HttpHandlers inWeb.fs
.
Defines a simple in-memory database that stores objects associated with a primary key. The objects are of type 'T
. Keys are of type 'Key
.
type InMemoryDatabase<'Key, 'T when 'Key: comparison>
Defines separate in-memory databases to store pinneries and pins.
A Pinnery is stored as a tuple:
- first element is the name
- the second element is the pinnery's location.
A pin is stored as a tuple
- first element is the name of the pin
- second element is the value as a decimal
- third element is the name of an existing pinnery
Defines structures for Pins and Pinneries
Contains the http handlers