**To run this via docker**

```shell
cd data-server
docker build -t data-server .
docker run data-server
```

**To rerun after a git pull**

```shell
docker stop $(docker ps | grep 'data-server' | cut -f 1 -d ' ')
docker build -t data-server .
docker run data-server
```

# Standards

A collection has items. These will be album releases, but because it contains
all other metadata together, a generic `item` term will be used. An `item`
holds everything needed to build the UI.

An `item` instance must have a `upc` key and value at the root level:

```
{
	"upc": "1234",
	... // everything else
}
```

If a `user_id` does not exist in the system, it will automatically be created
behind the scenes. Collections however will not.

User IDs are UUID format.


### Phase 1 Idea: One collection per user

**Get a user's default collection**

```
GET /user/<user_id>/collection
```

Returns a list of `item` values

```
[{...}, {...}]
```

**Add an item a user's default collection**

```
PUT /user/<user_id>/collection
```

With an `item` value (json glob).

**Remove an item from a user**

```
DELETE /user/<user_id>/collection
```

With a `upc` value.


### Phase 2 Idea: multiple collections per user

*Note: the API endpoints use collections (plural) instead of singular like in phase 1*

**Create a new collection**

```
GET /user/<user_id>/collections/new
```

Returns a collection id

```
"1234"
```


**Get a collection**

```
GET /user/<user_id>/collections/<collection_id>
```

Returns a list of `UPC` values

```
["1234", "4567"]
```


**Add a UPC to a collection**

```
PUT /user/<user_id>/collections/<collection_id>
```

with a `upc` value

Returns a list of `UPC` values

```
["1234", "4567", "7890"]
```


**Get list of collections for a user**

```
GET /user/<user_id>/collections/
```

Returns a list of collection ids

```
["1234", "3456", "5678"]
```

**Question**

Should these phase 2 last APIs return more like the following?

```
GET /user/<user_id>/collections/

[
	{
		"collection_id": "1234",
		"upc": ["1234", "5678"]
	},
	{
		"collection_id": "9876",
		"upc": ["1234", "5678"]
	}
]
```
