This repository was archived by the owner on Oct 30, 2023. It is now read-only.
File tree Expand file tree Collapse file tree
src/services/user-subscription Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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" ,
Original file line number Diff line number Diff line change 1-
1+ const errors = require ( 'feathers-errors' )
22
33module . 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+ }
You can’t perform that action at this time.
0 commit comments