Newer
Older
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
const bodyParser = require('body-parser')
const FragmentsRecommendations = app => {
app.use(bodyParser.json())
const basePath =
'/api/collections/:collectionId/fragments/:fragmentId/recommendations'
const routePath = './routes/fragmentsRecommendations'
const authBearer = app.locals.passport.authenticate('bearer', {
session: false,
})
/**
* @api {post} /api/collections/:collectionId/fragments/:fragmentId/recommendations Create a recommendation on a fragment
* @apiGroup FragmentsRecommendations
* @apiParam {collectionId} collectionId Collection id
* @apiParam {fragmentId} fragmentId Fragment id
* @apiParamExample {json} Body
* {
* "recommendation": "accept", [acceptedValues: accept, revise, etc.],
* "comments":
* [
* {
* "content": "A very nice manuscript",
* "public": true
* "files":
* [
* {
* "id": "111-22-333",
* "name": "file.pdf",
* "size": 104232
* }
* ]
* }
* ],
* "type": "review" [acceptedValues: review, editorRecommendation]
* }
* @apiSuccessExample {json} Success
* HTTP/1.1 200 OK
* {
* "id": "7b2431af-210c-49f9-a69a-e19271066ebd",
* "userId": "4c3f8ee1-785b-4adb-87b4-407a27f652c6",
* "submittedOn": 1525428890167,
* "recommendation": "accept", [acceptedValues: accept, revise, etc.],
* "comments":
* [
* {
* "content": "A very nice manuscript",
* "public": true
* "files":
* [
* {
* "id": "111-22-333",
* "name": "file.pdf",
* "size": 104232
* }
* ]
* }
* ],
* "type": "review" [acceptedValues: review, editorRecommendation]
* }
* @apiErrorExample {json} Invite user errors
* HTTP/1.1 403 Forbidden
* HTTP/1.1 400 Bad Request
* HTTP/1.1 404 Not Found
* HTTP/1.1 500 Internal Server Error
*/
app.post(
basePath,
authBearer,
require(`${routePath}/post`)(app.locals.models),
)
}
module.exports = FragmentsRecommendations