Models - Gibbo3771/slave-free-chocolate GitHub Wiki

Below is a list of models that are currently used for the data.

  • Source
  • Stamp
  • Origin
  • Tag
  • Location

Source

A source represents the place of business that manufactures the chocolate.

Fields:

Field Type Description
id integer PK
name string The name of the source as listed by the source. Basically it's the company name
href string The link for the sources website, or if not present, a social media account associated
stamps stamp[] A list of stamps this source has
origins origin[] A list of origins this source has
tags tag[] A list of tags this source has
locations location[] A list of locations this source has
  • You can assume if a source at least one Location model then you can physically go to that place and buy the product.
  • A source can anything from zero or more of stamps, tags and locations
  • A source will always have an origin. If the origin is unknown it will have the default origin of 'unknown'.

Endpoints

/api/v1/sources

This endpoint gets all sources.

/api/v1/sources/:id

This endpoint will get a specific source given an ID.

Stamp

A stamp is a certification or verification symbol that is granted by an authorising body.

Fields:

Field Type Description
id integer PK
title string The title of the stamp as described by the authorising body
description string An excerpt from the authorising bodies website that somewhat summarises the stamp
href string The link to the authorising body

Endpoints

/api/v1/stamps

This endpoint gets all the stamps.

/api/v1/stamps/:id

This endpoint will get a specific stamp given an ID.

Origin

An origin is where a source gets their cocao from.

Fields:

Field Type Description
id integer PK
name string The name of the origin

Endpoints

/api/v1/origins

This endpoint gets all the stamps.

/api/v1/origins/:id

This endpoint will get a specific origin given an ID.

Tag

A tag is a way in giving a source some criteria that can be checked against. Tags will allow you to filter by thing such as Vegan, Soy Free, Gluten Free etc.

Fields:

Field Type Description
id integer PK
name string The name of the tag

Endpoints

/api/v1/tags

This endpoint gets all the tags.

/api/v1/tags/:id

This endpoint will get a specific tag given an ID.

Location

A location represents a place you can buy the chocolate (or other choco containing products) from. I have tried to keep this strictly to two criteria:

  • It must be owned and operated by the business
  • If it's a factory, it must have either a cafe or tours available

Fields:

Field Type Description
id integer PK
country string The country
state string The state
city string The city
street string The street
building_no string The building number or name
zip string The zip or postal code
source_id integer Foreign Key. The source that is at this location

Endpoints

/api/v1/locations

This endpoint gets all the locations.

/api/v1/location/:id

This endpoint will get a specific location given an ID.