Skip to content
This repository was archived by the owner on Oct 30, 2023. It is now read-only.

Commit 7feab4a

Browse files
authored
Merge pull request #60 from FlowzPlatform/changes-based-on-My-Plans-UI
Done changes for user-subscription
2 parents 9abc5b1 + 19019fa commit 7feab4a

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

service/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
"compression": "^1.7.1",
3636
"cors": "^2.8.4",
3737
"feathers": "^2.2.3",
38+
"feathers-authentication": "^1.3.1",
39+
"feathers-authentication-jwt": "^0.3.2",
3840
"feathers-configuration": "^0.4.2",
3941
"feathers-errors": "^2.9.2",
4042
"feathers-hooks": "^2.1.2",

service/src/services/user-subscription/user-subscription.hooks.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
1+
const errors = require('feathers-errors')
22

33
module.exports = {
44
before: {
55
all: [],
6-
find: [],
6+
find: [
7+
hook => findBefore(hook)
8+
],
79
get: [],
810
create: [],
911
update: [],
@@ -31,3 +33,14 @@ module.exports = {
3133
remove: []
3234
}
3335
};
36+
37+
function findBefore(hook) {
38+
if(hook.params.userPackageDetails !== undefined && hook.params.userPackageDetails._id !== undefined){
39+
hook.params.query = {
40+
userId: hook.params.userPackageDetails._id,
41+
$limit: hook.params.query.$limit
42+
}
43+
} else {
44+
throw new errors.NotAuthenticated('Invalid token');
45+
}
46+
}

0 commit comments

Comments
 (0)