-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
607 lines (515 loc) · 18.8 KB
/
index.html
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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Document Management System Index</title>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
<link type="text/css" rel="stylesheet" href="styles/site.flatly.css">
</head>
<body>
<div class="navbar navbar-default navbar-fixed-top ">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="index.html">Document Management System</a>
<button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#topNavigation">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="navbar-collapse collapse" id="topNavigation">
<ul class="nav navbar-nav">
<li class="dropdown">
<a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li><a href="global.html#ControllerHelper">ControllerHelper</a></li><li><a href="global.html#ResetHelper">ResetHelper</a></li><li><a href="global.html#SeedHelper">SeedHelper</a></li><li><a href="global.html#UsersAuthentication">UsersAuthentication</a></li>
</ul>
</li>
<li class="dropdown">
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li><a href="global.html#DocumentsController">DocumentsController</a></li><li><a href="global.html#RolesController">RolesController</a></li><li><a href="global.html#UsersController">UsersController</a></li><li><a href="global.html#value">value</a></li>
</ul>
</li>
</ul>
<div class="col-sm-3 col-md-3">
<form class="navbar-form" role="search">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search" name="q" id="search-input">
<div class="input-group-btn">
<button class="btn btn-default" id="search-submit"><i class="glyphicon glyphicon-search"></i></button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="container" id="toc-content">
<div class="row">
<div class="col-md-8">
<div id="main">
<section class="readme-section">
<article><h2>Below are the API endpoints and their functions</h2><table>
<thead>
<tr>
<th>EndPoint</th>
<th>Functionality</th>
</tr>
</thead>
<tbody>
<tr>
<td>POST /users/login</td>
<td>Logs a user in</td>
</tr>
<tr>
<td>POST /users/logout</td>
<td>Logs a user out</td>
</tr>
<tr>
<td>POST /users</td>
<td>Creates a new user</td>
</tr>
<tr>
<td>GET /users</td>
<td>Find matching instances of user</td>
</tr>
<tr>
<td>GET /users?limit=num</td>
<td>Limits the users return, defaults to ten</td>
</tr>
<tr>
<td>GET /users?limit=num&offset=num</td>
<td>Sets the next users to get </td>
</tr>
<tr>
<td>GET /users/:id</td>
<td>Gets a single user</td>
</tr>
<tr>
<td>GET /search/users?search=myname</td>
<td>Search the users based on search query param</td>
</tr>
<tr>
<td>GET /users/:id/documents</td>
<td>Retrieve all documents belonging to a user</td>
</tr>
<tr>
<td>PUT /users/:id</td>
<td>Update user</td>
</tr>
<tr>
<td>DELETE /users/:id</td>
<td>Delete user</td>
</tr>
<tr>
<td>POST /documents</td>
<td>Creates a new document instance</td>
</tr>
<tr>
<td>GET /documents</td>
<td>Find matching instances of document</td>
</tr>
<tr>
<td>GET /search/documents?search=doc</td>
<td>Search the documents based on the query param </td>
</tr>
<tr>
<td>GET /documents?limit=num</td>
<td>Limits the documents return, defaults to ten</td>
</tr>
<tr>
<td>GET /documents?limit=num&offset=num</td>
<td>Sets the next documents to get </td>
</tr>
<tr>
<td>GET /documents/:id</td>
<td>Find document</td>
</tr>
<tr>
<td>PUT /documents/:id</td>
<td>Update document attributes</td>
</tr>
<tr>
<td>DELETE /documents/:id</td>
<td>Delete document</td>
</tr>
<tr>
<td>POST /roles</td>
<td>Creates a new role</td>
</tr>
<tr>
<td>GET /roles/</td>
<td>Find matching instances of role </td>
</tr>
<tr>
<td>GET /roles?limit=num</td>
<td>limits the roles return, maximum of ten</td>
</tr>
<tr>
<td>GET /roles?limit=num&offset=num</td>
<td>Sets the next role to get </td>
</tr>
<tr>
<td>GET /roles/:id</td>
<td>Gets a single role</td>
</tr>
<tr>
<td>GET /search/roles?search=regular</td>
<td>Search the roles based on the query param </td>
</tr>
<tr>
<td>PUT /roles/:id</td>
<td>Update role</td>
</tr>
<tr>
<td>DELETE /roles/:id</td>
<td>Delete role</td>
</tr>
</tbody>
</table>
<p>The following are some sample request and response from the API:</p>
<h2>Roles</h2><p>Endpoint for Roles API.</p>
<h3>Get Roles</h3><h4>Request</h4><ul>
<li>Endpoint: GET: <code>/api/roles</code></li>
<li>Requires: Authentication</li>
</ul>
<h4>Response</h4><ul>
<li>Status: <code>200: OK</code></li>
<li>Body <code>(application/json)</code><pre class="prettyprint source lang-json"><code>[
{
"id": 1,
"title": "admin",
"createdAt": "2017-05-01 16:07:46.719+01",
"updatedAt": "2017-05-01 16:07:46.719+01"
}, {
"id": 2,
"title": "regular",
"createdAt": "2017-05-01 16:07:46.719+01",
"updatedAt": "2017-05-01 16:07:46.719+01"
}
]</code></pre></li>
</ul>
<h2>Users</h2><p>Endpoint for Users API.</p>
<h3>Create User</h3><h4>Request</h4><ul>
<li>Endpoint: POST: <code>api/users</code></li>
<li>Body <code>(application/json)</code><pre class="prettyprint source lang-json"><code>{
"name": "John Doe",
"email": "[email protected]",
"password": "password"
}</code></pre></li>
</ul>
<h4>Response</h4><ul>
<li>Status: <code>201: Created</code></li>
<li>Body <code>(application/json)</code><pre class="prettyprint source lang-json"><code>{
"user": {
"id": 22,
"name": "John Doe",
"email": "[email protected]",
"RoleId": 2,
"createdAt": "2017-05-01 16:07:46.719+01",
"updatedAt": "2017-05-01 16:07:46.719+01"
},
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjE2LCJyb2xlSWQiOjIsImlhdCI6MTQ5MzMyNTI3OCwiZXhwIjoxNDkzMzY4NDc4fQ.-C3UQhJKK1t7FVFCMjsBNIH5uuGPoCjtS85mha-Go6Y"
}</code></pre></li>
</ul>
<h3>Get Users</h3><h4>Request</h4><ul>
<li>Endpoint: GET: <code>api/users</code></li>
<li>Requires: Authentication</li>
</ul>
<h4>Response</h4><ul>
<li>Status: <code>200: OK</code></li>
<li>Body <code>(application/json)</code><pre class="prettyprint source lang-json"><code>[{
"id": 10,
"name": "Mercy oseni",
"email": "[email protected]",
"RoleId": 1,
"password": "$2a$08$P6AgSC3bC9IwmKeJSfUAye5/hVIvdoLRq3wMpPRgsAsUgz19ltQ6q",
"createdAt": "2017-05-01 16:07:46.719+01",
"updatedAt": "2017-05-01 16:07:46.719+01"
},
{
"id": 14,
"name": "Faith Omokaro",
"email": "[email protected]",
"RoleId": 2,
"password": "$2a$05$dHcq6G2aQucBb9SvuJJ.quuxBMRdt4fNI0aUvgsWz0hxyrRql8PuS",
"createdAt": "2017-05-01 16:07:46.719+01",
"updatedAt": "2017-05-01 16:07:46.719+01"
}]</code></pre></li>
</ul>
<h2>Documents</h2><p>Endpoint for document API.</p>
<h3>Create Document</h3><h4>Request</h4><ul>
<li>Endpoint: POST: <code>/api/documents</code></li>
<li>Requires: Authentication</li>
<li>Body <code>(application/json)</code><pre class="prettyprint source lang-json"><code>{
"title": "YOYOL",
"content": "In Andela, it's more of self-learning. We believe You Own Your Own Learning!",
"OwnerId": 1,
"access": "public"
}</code></pre></li>
</ul>
<h4>Response</h4><ul>
<li>Status: <code>201: Created</code></li>
<li>Body <code>(application/json)</code><pre class="prettyprint source lang-json"><code>{
"id": 4,
"title": "YOYOL",
"content": "In Andela, it's more of self-learning. We believe You Own Your Own Learning!",
"OwnerId": 1,
"access": "public",
"createdAt": "2017-05-01T14:59:11.785Z",
"updatedAt": "2017-05-01T14:59:11.785Z"
}</code></pre></li>
</ul>
<h3>Get All Documents</h3><h4>Request</h4><ul>
<li>Endpoint: GET: <code>/api/documents</code></li>
<li>Requires: Authentication</li>
</ul>
<h4>Response</h4><ul>
<li>Status: <code>200: OK</code></li>
<li>Body <code>(application/json)</code><pre class="prettyprint source lang-json"><code>[{
"title": "Computer Science",
"content": "Computer science is the study of the theory, experimentation,and engineering that form the basis for the design and use of computers. It is the scientific and practical approach to computation and its applicationsand the systematic study of the feasibility, structure, expression, and mechanization of the methodical procedures (or algorithms) that underlie the acquisition, representation, processing, storage, communication of, and access to information.",
"access": "role",
"type": "Education",
"OwnerId": 2,
"createdAt": "2017-05-01T14:59:27.120Z",
"updatedAt": "2017-05-01T14:59:27.120Z"
},
{
"title": "Triple-buffered composite budgetary management",
"content": "Nihil quidem quia. Minus ea architecto odit eum alias quia similique recusandae. Cum reiciendis similique quia aut quod officia molestias. Doloribus ea id voluptatibus id iure ut illum voluptas necessitatibus. Ullam nemo facere neque omnis repellat magnam ut totam.",
"access": "public",
"type": "Note",
"OwnerId": 5,
"createdAt": "2017-05-01T14:59:11.785Z",
"updatedAt": "2017-05-01T14:59:11.785Z"
},
{
"id": 4,
"title": "YOYOL",
"content": "In Andela, it's more of self-learning. We believe You Own Your Own Learning!",
"OwnerId": 1,
"access": "public",
"type": "note",
"createdAt": "2017-05-01T14:59:11.785Z",
"updatedAt": "2017-05-01T14:59:11.785Z"
}]</code></pre></li>
</ul>
<h3>Get Document</h3><h4>Request</h4><ul>
<li>Endpoint: GET: <code>/api/documents/:id</code></li>
<li>Requires: Authentication</li>
</ul>
<h4>Response</h4><ul>
<li>Status: <code>200: OK</code></li>
<li>Body <code>(application/json)</code><pre class="prettyprint source lang-json"><code>{
"id": 4,
"title": "YOYOL",
"content": "In Andela, it's more of self-learning. We believe You Own Your Own Learning!",
"OwnerId": 1,
"access": "public",
"type": "note",
"createdAt": "2017-05-01T14:59:11.785Z",
"updatedAt": "2017-05-01T14:59:11.785Z"
}</code></pre></li>
</ul>
<h3>Edit Document</h3><h4>Request</h4><ul>
<li>Endpoint: PUT: <code>/api/documents/:id</code></li>
<li>Requires: Authentication</li>
<li>Body <code>(application/json)</code>:<pre class="prettyprint source lang-json"><code>{
"title": "YOYOL!!!",
}</code></pre></li>
</ul>
<h4>Response</h4><ul>
<li>Status: <code>200: OK</code></li>
<li>Body <code>(application/json)</code><pre class="prettyprint source lang-json"><code>{
"id": 4,
"title": "YOYOL!!!",
"content": "In Andela, it's more of self-learning. We believe You Own Your Own Learning!",
"OwnerId": 1,
"access": "public",
"type": "note",
"createdAt": "2017-05-01T14:59:11.785Z",
"updatedAt": "2017-05-01T15:35:00.785Z"
}</code></pre></li>
</ul>
<h3>Delete Document</h3><h4>Request</h4><ul>
<li>Endpoint: DELETE: <code>/api/documents/:id</code></li>
<li>Requires: Authentication</li>
</ul>
<h4>Response</h4><ul>
<li>Status: <code>200: OK</code></li>
<li>Body <code>(application/json)</code><pre class="prettyprint source lang-json"><code>{
"message": "Document deleted successfully"
}</code></pre></li>
</ul>
<h3>Search</h3><h4>Documents</h4><h4>Request</h4><ul>
<li>Endpoint: GET: <code>/search/documents/?search=searchterm</code></li>
<li>Requires: Authentication</li>
</ul>
<h4>Response</h4><ul>
<li>Status: <code>200: OK</code></li>
<li><p>Body <code>(application/json)</code></p>
<pre class="prettyprint source lang-json"><code>
[{
"title": "Computer Science",
"content": "Computer science is the study of the theory, experimentation,and engineering that form the basis for the design and use of computers. It is the scientific and practical approach to computation and its applicationsand the systematic study of the feasibility, structure, expression, and mechanization of the methodical procedures (or algorithms) that underlie the acquisition, representation, processing, storage, communication of, and access to information.",
"access": "role",
"type": "Education",
"OwnerId": 2,
"createdAt": "2017-05-01T01:29:21.469Z",
"updatedAt": "2017-05-01T01:29:21.469Z"
}]</code></pre></li>
</ul>
<h3>Users</h3><h4>Request</h4><ul>
<li>Endpoint: GET: <code>/search/users/?search=searchterm</code></li>
<li>Requires: Authentication</li>
</ul>
<h4>Response</h4><ul>
<li>Status: <code>200: OK</code></li>
<li>Body <code>(application/json)</code><pre class="prettyprint source lang-json"><code>[{
"name": "Mercy Oseni",
"email": "[email protected]",
"createdAt": "2017-05-01T01:29:21.457Z",
"updatedAt": "2017-05-01T01:29:21.457Z"
},
{
"name": "Faith Omokaro",
"email": "[email protected]",
"createdAt": "2017-05-01T01:29:21.457Z",
"updatedAt": "2017-05-01T01:29:21.457Z"
},
{
"name": "Sophiat Ayomide",
"email": "[email protected]",
"createdAt": "2017-05-01T01:29:21.457Z",
"updatedAt": "2017-05-01T01:29:21.457Z"
}]</code></pre></li>
</ul></article>
</section>
</div>
</div>
<div class="clearfix"></div>
<div class="col-md-3">
<div id="toc" class="col-md-3 hidden-xs hidden-sm hidden-md"></div>
</div>
</div>
</div>
<div class="modal fade" id="searchResults">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title">Search results</h4>
</div>
<div class="modal-body"></div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>
<footer>
<span class="copyright">
Mercy Oseni © 2017
</span>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>
on 2017-06-06T15:15:33+01:00
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
</footer>
<script src="scripts/docstrap.lib.js"></script>
<script src="scripts/toc.js"></script>
<script type="text/javascript" src="scripts/fulltext-search-ui.js"></script>
<script>
$( function () {
$( "[id*='$']" ).each( function () {
var $this = $( this );
$this.attr( "id", $this.attr( "id" ).replace( "$", "__" ) );
} );
$( ".tutorial-section pre, .readme-section pre, pre.prettyprint.source" ).each( function () {
var $this = $( this );
var example = $this.find( "code" );
exampleText = example.html();
var lang = /{@lang (.*?)}/.exec( exampleText );
if ( lang && lang[1] ) {
exampleText = exampleText.replace( lang[0], "" );
example.html( exampleText );
lang = lang[1];
} else {
var langClassMatch = example.parent()[0].className.match(/lang\-(\S+)/);
lang = langClassMatch ? langClassMatch[1] : "javascript";
}
if ( lang ) {
$this
.addClass( "sunlight-highlight-" + lang )
.addClass( "linenums" )
.html( example.html() );
}
} );
Sunlight.highlightAll( {
lineNumbers : true,
showMenu : true,
enableDoclinks : true
} );
$.catchAnchorLinks( {
navbarOffset: 10
} );
$( "#toc" ).toc( {
anchorName : function ( i, heading, prefix ) {
return $( heading ).attr( "id" ) || ( prefix + i );
},
selectors : "#toc-content h1,#toc-content h2,#toc-content h3,#toc-content h4",
showAndHide : false,
smoothScrolling: true
} );
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
$( '.dropdown-toggle' ).dropdown();
$( "table" ).each( function () {
var $this = $( this );
$this.addClass('table');
} );
} );
</script>
<!--Navigation and Symbol Display-->
<script>
$( function () {
$( '#main' ).localScroll( {
offset : { top : 60 } //offset by the height of your header (give or take a few px, see what works for you)
} );
$( "dt.name" ).each( function () {
var $this = $( this ).find("h4");
var icon = $( "<i/>" ).addClass( "icon-plus-sign" ).addClass( "pull-right" ).addClass( "icon-white" );
var dt = $(this);
var children = dt.next( "dd" );
dt.prepend( icon ).css( {cursor : "pointer"} );
dt.addClass( "member-collapsed" ).addClass( "member" );
children.hide();
dt.children().on( "click", function () {
children = dt.next( "dd" );
children.slideToggle( "fast", function () {
if ( children.is( ":visible" ) ) {
icon.addClass( "icon-minus-sign" ).removeClass( "icon-plus-sign" ).removeClass( "icon-white" );
dt.addClass( "member-open" ).animate( "member-collapsed" );
} else {
icon.addClass( "icon-plus-sign" ).removeClass( "icon-minus-sign" ).addClass( "icon-white" );
dt.addClass( "member-collapsed" ).removeClass( "member-open" );
}
} );
} );
} );
} );
</script>
<!--Google Analytics-->
<script type="text/javascript">
$(document).ready(function() {
SearcherDisplay.init();
});
</script>
</body>
</html>