forked from topcoder-archive/submissions-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReviewTypeController.js
More file actions
executable file
·71 lines (63 loc) · 1.58 KB
/
Copy pathReviewTypeController.js
File metadata and controls
executable file
·71 lines (63 loc) · 1.58 KB
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
/**
* ReviewType Controller
*/
const ReviewTypeService = require('../services/ReviewTypeService')
const helper = require('../common/helper')
/**
* Get review type
* @param req the http request
* @param res the http response
*/
function * getReviewType (req, res) {
res.json(yield ReviewTypeService.getReviewType(req.params.reviewTypeId))
}
/**
* List review types from ES
* @param req the http request
* @param res the http response
*/
function * listReviewTypes (req, res) {
const data = yield ReviewTypeService.listReviewTypes(req.query)
helper.setPaginationHeaders(req, res, data)
}
/**
* Create review type
* @param req the http request
* @param res the http response
*/
function * createReviewType (req, res) {
res.json(yield ReviewTypeService.createReviewType(req.body))
}
/**
* Update review type
* @param req the http request
* @param res the http response
*/
function * updateReviewType (req, res) {
res.json(yield ReviewTypeService.updateReviewType(req.params.reviewTypeId, req.body))
}
/**
* Patch review type
* @param req the http request
* @param res the http response
*/
function * patchReviewType (req, res) {
res.json(yield ReviewTypeService.patchReviewType(req.params.reviewTypeId, req.body))
}
/**
* Delete review type
* @param req the http request
* @param res the http response
*/
function * deleteReviewType (req, res) {
yield ReviewTypeService.deleteReviewType(req.params.reviewTypeId)
res.status(204).send()
}
module.exports = {
getReviewType,
listReviewTypes,
createReviewType,
updateReviewType,
patchReviewType,
deleteReviewType
}