summaryrefslogtreecommitdiffstats
path: root/DESIGN.md
blob: be60bf5b4ae974acad34f571aa4127d4aee91f80 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# endpoints

## authentication
GET /login
POST /login
GET /signup

## user management
POST /users
GET /users
GET /users/:user
GET /users/:user/edit 
PUT /users/:user
DELETE /users/:user

## board management
POST /boards
GET /boards
GET /boards/:board
GET /boards/:board/edit
PUT /boards/:board
DELETE /boards/:board

## pin management
POST /pins
GET /pins
GET /pins/:pin
GET /pins/:pin/edit
PUT /pins/:pin
DELETE /pins/:pin

## files
GET /files/:file

# structures

Enum Privacy {
	Private
	Unlisted
	Public
}

User {
    id int primary key
	username string unique
	email string unique
	password string
	bio text
	site string
	profile_picture string
	privacy privacy
	admin bool
}

board {
    id int primary key
	name string
	description text
	privacy privacy
}

board_ownership {
	owner user_id
	board board_id
	primary key owner board
}

enum file_type {
	image
	audio
	video
	document
	site
	other
}

files {
    id int primary key
	thumbnail string (file path)
	path string
	type file_type
	alt_text text
	pin foreign key
}

// pins 
pin {
	id int primary key
	subject text optional
	text text
	notes text
	source_url string
}

tags {
	tag
}

pin_tags {
	ids many to many
}

pins_boards {
	pin pin_id foreign
	board board_id foreign
	primary key pin board
}

pins_owners {
	owner user_id
	pin pin_id
	primary key (owner, pin)
}