aboutsummaryrefslogtreecommitdiff
path: root/server_info.txt
blob: 6b317fc439bdb1fb7b5d739c44c77f641fce7668 (plain)
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
********************************************************************************
********************* REQUEST AND SERVE DOCUMENTATION **************************
********************************************************************************
This document lays down the pertinent information for requesting and serving 
data between front-end and server. The structure is styled in a pseudo jquery
ajax call format with notes provided. 

There are 3 categories. Admin only requests are the requests made only the 
admin, likewise for users. All visitor requests are requests that everyone that
visits the website can make.

Assume content/data-types are json format (they are omitted).
Standard serves for styles/images/script files are omitted. 

******************************** ADMIN ONLY ************************************
N/A

********************************* USERS ONLY ***********************************
Requests made by logged in users. User credentials required. 

Note: Look into authenticating users and saving login session data. Probably 
store session data in database. 
--------------------------------------------------------------------------------
LOGIN
--------------------------------------------------------------------------------
Description: User login
Method: 'POST'
url: '/login'
Data: userData = {
	username: 'jsmith85', 	// Consider whether we need to secure this as well
	password: 'blahblah' 	// Come back to this for a more secure method*
}
On Success: Return response such that: 

response = {type: typeOfUser} // Where typeOfUser takes on  'admin' or 'user'

Notes: 	We'll have to save information to keep this user in a login-state
		There is probably a way to save credentials securely, and then 
		authenticate  from server for other tasks on the web app. 

--------------------------------------------------------------------------------
USER-PROFILE - Receive info
--------------------------------------------------------------------------------
Description: 
Method: 
Url: 
Data: 
On Success:
Notes:  

--------------------------------------------------------------------------------
USER-PROFILE - Edit info
--------------------------------------------------------------------------------
Description: 
Method: 
Url: 
Data: 
On Success:
Notes: 

--------------------------------------------------------------------------------
SOLUTION UPLOAD
--------------------------------------------------------------------------------
Description: 
Method: 
Url: 
Data: 
On Success:
Notes: 

--------------------------------------------------------------------------------
COMMENT ON SOLUTION
--------------------------------------------------------------------------------
Description: 
Method: 
Url: 
Data: 
On Success:
Notes: 

--------------------------------------------------------------------------------
UP/DOWNVOTE A SOLUTION
--------------------------------------------------------------------------------
Description: 
Method: 
Url: 
Data: 
On Success:
Notes: 


********************************* ALL VISITORS *********************************

Requests made by any users, no credentials required. 

--------------------------------------------------------------------------------
SIGN UP
--------------------------------------------------------------------------------
Description: Post user information filled out from a form to server.

Method: 'POST'
Url: '/signUp'
Data: userData = {
	firstName: 'John',
	lastName:  'Smith',
	username:  'jsmith85',
	password:  'blahblah', 	// Come back to this for a more secure method*
	University: 'UofT', 	// optional
	Department: 'Optional' 	// optional
}
On success: 
	- no data required

Notes: 	Might add more fields, will re-visit, design such a way that
		adding more fields for a user is not difficult to change. 


--------------------------------------------------------------------------------
EXAM - Page
--------------------------------------------------------------------------------
Description: The information sent/served when a user does a specific query for
an exam.

Method: 'GET'
Url: '/exam'
Data: examTitle = {
	courseCode: 'csc148',
	termOffered: 'Fall', 		
	dateOffered: 'June2014',
	campus: 'St.George', 
}
On Success: Return response such that: 
response = {
	courseCode: 'csc148'
	instructors: 'Paul Grieves and Danny Heap',
	uploadDate: '2014-01-26'
	pageCount: 22
	questionCount: 10 
	questions: {question1, question2,...},
	path: '/exams/stgeorge/2014/fall/csc148.pdf'
}

Where each questionN is a question object such that: 
questionN = {
	questionNumber: 1,
	solutionCount: 2,
	commentCount: 6
}

--------------------------------------------------------------------------------
QUESTION - SOLUTIONS - PAGE
--------------------------------------------------------------------------------
Description: Page displayed when user queries for a specific exam questions
solution. Information displayed includes: each submitted solution, where each
solution contains the user uploader details, date uploaded, up/down score,
solution plain-text, comments (where each comment contains commenter's info).

Method: 'GET'
Url: '/solution'
Data: examTitle = {
      	courseCode: 'csc148',
      	termOffered: 'Fall',
      	dateOffered: 'June2014',
      	campus: 'St.George',
      	question: 2
      }
On Success: Return a response such that:
response = {
    solutions: [solution1, solution2, ....]
}

Where each solutionN is a solution object such that:

solutionN = {
    uploaderUsername: 'jSmith123',
    uploaderAvatarPath: '/assets/images/avatars/jSmith123.png',
    uploaderUpvotes: 3,
    uploaderDownvotes: -1,
    solution: 'In this solution we solve it by doing x then y and ta-da!',
    comments: [comment1, comment2, ....]
}

where each commentN is a comment object such that:

commentN = {
    username: 'janeDoe456',
    avatarPath: '/assets/images/avatars/janeDoe456.png',
    comment: 'This is a good answer!'
}

--------------------------------------------------------------------------------
-------------------------------- SEARCHING -------------------------------------
--------------------------------------------------------------------------------
Search bar requests will be divided into 2 separate types of requests from the 
server. Each request will be a different ajax call. This is dependent on the the 
drop-down value on the search bar. 
	1) Request Users: Serve the users with matching information provided
	2) Request Courses: Serve the courses with the matching course code 

Users can also request exams for a course via the nav menu. This is essentially
the same as performing a request for courses through search bar for our purposes
so we don't need another call for nav. 
--------------------------------------------------------------------------------
SEARCH-BAR - Courses
--------------------------------------------------------------------------------
Description: Any visitor can do a search by courses, server must respond with
all exams that are categorized by the course searched (from front end). 

Method: 'GET'
Url: '/search/courses'
Data: search = 'abcxzy' //where abc are letters and xzy are integers
On success: return response such that: 
response = {
	courses: [course1, course2, course3]
}

Where each courseN is a course object such that: 

courseN = {
	courseName: 'Intro to Computer Science',
	courseCode: 'CSC148', 
	commentCount: '13', 
	solutionCount: '3'
	termOffered: 'Fall',
	dateOffered: 'June/2014'
	camus: 'St.George'  		// Other values: 'Mississauga'/'Scarborough'
}

--------------------------------------------------------------------------------
SEARCH-BAR - Users
--------------------------------------------------------------------------------
Description: Any visitor can do a search by users, server must respond with
all users with usernames where the provided keyword (from front-end) is a 
substring of the username. 

Method: 'GET'
Url: '/search/users'
Data: search = 'subString' 
On Success: return response such that: 
response = {
	users: [user1, user2, user3]
}

Where each userN is a user object such that: 

userN = {
	username: 'janeDoe456',
	avatarPath: '/assets/images/avatars/janeDoe456.png', 	// 'N/A' if it d.n.e.
	points: 100, 								
	commentCount: 13, 
	solutionCount: 3
}