Skip to content

Commit f46daca

Browse files
authored
Merge pull request #168 from chqy24/dev
SERVICE REQUEST
2 parents 98086a3 + d642e52 commit f46daca

18 files changed

+347
-303
lines changed

common/Permission.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ const User = require('../models').User;
2424
function providerRoleCheck(req, res, next) {
2525
User.findOne({_id: req.auth.sub}, (err, user) => {
2626
if (!user) {
27-
throw new errors.AuthenticationRequiredError('Anonymous is not allowed to access', 401);
27+
next(new errors.AuthenticationRequiredError('Anonymous is not allowed to access', 401));
28+
return;
2829
}
2930

3031
if (user.role !== Role.PROVIDER || !user.provider) {
31-
throw new errors.NotPermittedError('Non-provider is not allowed to access', 403);
32+
next(new errors.NotPermittedError('Non-provider is not allowed to access', 403));
33+
return;
3234
}
3335
req.auth.payload = {
3436
role: Role.PROVIDER,

controllers/PackageRequestController.js

+5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const helper = require('../common/helper');
1818
module.exports = {
1919
create,
2020
get,
21+
getSingle,
2122
search,
2223
accept,
2324
reject,
@@ -51,6 +52,10 @@ function* get(req, res) {
5152
}
5253

5354

55+
function* getSingle(req, res) {
56+
res.json(yield PackageRequestService.getSingle(req.auth.sub, req.params.id));
57+
}
58+
5459
/**
5560
* get all packageRequests of current provider and lauchDate,statuses
5661
* @param req

data/categories.json

+1-13
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
11
[{
22
"name": "Delivery"
33
}, {
4-
"name": "Mapping"
5-
}, {
6-
"name": "Monitoring"
7-
}, {
8-
"name": "Photography"
9-
}, {
10-
"name": "Filming"
11-
}, {
12-
"name": "Construction"
13-
}, {
14-
"name": "Lorem Ipsum"
15-
}, {
16-
"name": "Dolor Sit Amet"
4+
"name": "Imagery"
175
}]

0 commit comments

Comments
 (0)