11## Possible DB Layout
22
3- Master Table:
3+ ### Master Table:
44
55| id | tmdbid | imdbid | report_count | total_reports | locked |
66| ---| ----| ----| ---| ---| ---|
@@ -9,7 +9,7 @@ Master Table:
99| 3 | 11 | tt000011 | -5 | 10 | true |
1010| 4 | 2 | tt000002 | 4 | 50 | false |
1111
12- Title Mappings:
12+ ### Title Mappings:
1313
1414| mappingsid (Foreign Key) | aka_title | aka_clean_title |
1515| ----------| ---------------------| ---------|
@@ -19,20 +19,33 @@ Title Mappings:
1919
2020** Note:** Clean title is used to ensure that only one mapping per aka_title exists (should be unique). It also should help mapping with e.g. files.
2121
22- Year Mappings:
22+ ### Year Mappings:
2323
2424| mappingsid (Foreign Key) | aka_year |
2525| ----------| ----------|
2626| 3 | 1978 |
2727| 4 | 1999 |
2828| | |
2929
30+ ### Meta Table:
31+
32+ | mappingsid (Foreign Key) | Event Type | Date |
33+ | ----| ----| ----|
34+ | 1 | 0 | 2017-04-05:15:10:46 |
35+ | 2 | 1 | 2017-04-07:15:12:33 |
36+
37+ ** Event Types:**
38+ - Add Mapping: 0
39+ - Approve mapping: 1
40+ - Disapprove mappinng: 2
41+ - Lock mapping: 3
42+
3043
3144## Possible API
3245
3346### POST /mappings/add
3447
35- Add new Mapping
48+ Add new Mapping. If mapping already exists (determined via clean_title) it is "upvoted".
3649
3750#### Params
3851| name | type |
@@ -53,6 +66,7 @@ Add new Mapping
5366
5467```
5568{
69+ "id" : 1,
5670 "type" : "title",
5771 "tmdbid" : 11,
5872 "imdbid" : "tt0000011",
@@ -64,6 +78,7 @@ Add new Mapping
6478
6579```
6680{
81+ "id" : 2,
6782 "type" : "year",
6883 "tmdbid" : 11,
6984 "imdbid" : "tt0000011",
@@ -73,6 +88,48 @@ Add new Mapping
7388}
7489```
7590
91+ ### PUT /mappings/vote
92+
93+ "Vote" on existing mapping
94+
95+ #### Params
96+ | name | type |
97+ | --------| ----------|
98+ | id | int |
99+ | direction | int (either 1 or -1, default 1)|
100+
101+ #### Sample Request
102+
103+ ` PUT /mappings/vote?id=1&direction=1 `
104+
105+ ` PUT /mappings/vote?id=2&direction=-1 `
106+
107+ #### Sample Response
108+
109+ ```
110+ {
111+ "id" : 1,
112+ "type" : "title",
113+ "tmdbid" : 11,
114+ "imdbid" : "tt0000011",
115+ "aka_title" : "Star Wars",
116+ "report_count" : 2,
117+ "total_reports" : 2
118+ }
119+ ```
120+
121+ ```
122+ {
123+ "id" : 2,
124+ "type" : "year",
125+ "tmdbid" : 11,
126+ "imdbid" : "tt0000011",
127+ "aka_year" : 1978,
128+ "report_count" : 0,
129+ "total_reports" : 2
130+ }
131+ ```
132+
76133### GET /mappings/get
77134
78135Retrieve mappings for movie
0 commit comments