@@ -25,8 +25,8 @@ function handleError(res, statusCode) {
25
25
* restriction: 'admin'
26
26
*/
27
27
export function index ( req , res ) {
28
- < % if ( filters . mongooseModels ) { % > User . find ( { } , '-salt -password' ) . exec ( ) < % }
29
- if ( filters . sequelizeModels ) { % > User . findAll ( {
28
+ < % if ( filters . mongooseModels ) { % > return User . find ( { } , '-salt -password' ) . exec ( ) < % }
29
+ if ( filters . sequelizeModels ) { % > return User . findAll ( {
30
30
attributes : [
31
31
'_id' ,
32
32
'name' ,
@@ -52,7 +52,7 @@ export function create(req, res, next) {
52
52
if ( filters . sequelizeModels ) { % > var newUser = User . build ( req . body ) ;
53
53
newUser . setDataValue ( 'provider' , 'local' ) ;
54
54
newUser . setDataValue ( 'role' , 'user' ) ;
55
- newUser . save ( ) < % } % >
55
+ return newUser . save ( ) < % } % >
56
56
. then ( function ( user ) {
57
57
var token = jwt . sign ( { _id : user . _id } , config . secrets . session , {
58
58
expiresIn : 60 * 60 * 5
@@ -68,8 +68,8 @@ export function create(req, res, next) {
68
68
export function show ( req , res , next ) {
69
69
var userId = req . params . id ;
70
70
71
- < % if ( filters . mongooseModels ) { % > User . findById ( userId ) . exec ( ) < % }
72
- if ( filters . sequelizeModels ) { % > User . find ( {
71
+ < % if ( filters . mongooseModels ) { % > return User . findById ( userId ) . exec ( ) < % }
72
+ if ( filters . sequelizeModels ) { % > return User . find ( {
73
73
where : {
74
74
_id : userId
75
75
}
@@ -88,8 +88,8 @@ export function show(req, res, next) {
88
88
* restriction: 'admin'
89
89
*/
90
90
export function destroy ( req , res ) {
91
- < % if ( filters . mongooseModels ) { % > User . findByIdAndRemove ( req . params . id ) . exec ( ) < % }
92
- if ( filters . sequelizeModels ) { % > User . destroy ( { _id : req . params . id } ) < % } % >
91
+ < % if ( filters . mongooseModels ) { % > return User . findByIdAndRemove ( req . params . id ) . exec ( ) < % }
92
+ if ( filters . sequelizeModels ) { % > return User . destroy ( { _id : req . params . id } ) < % } % >
93
93
. then ( function ( ) {
94
94
res . status ( 204 ) . end ( ) ;
95
95
} )
@@ -104,8 +104,8 @@ export function changePassword(req, res, next) {
104
104
var oldPass = String ( req . body . oldPassword ) ;
105
105
var newPass = String ( req . body . newPassword ) ;
106
106
107
- < % if ( filters . mongooseModels ) { % > User . findById ( userId ) . exec ( ) < % }
108
- if ( filters . sequelizeModels ) { % > User . find ( {
107
+ < % if ( filters . mongooseModels ) { % > return User . findById ( userId ) . exec ( ) < % }
108
+ if ( filters . sequelizeModels ) { % > return User . find ( {
109
109
where : {
110
110
_id : userId
111
111
}
@@ -130,8 +130,8 @@ export function changePassword(req, res, next) {
130
130
export function me ( req , res , next ) {
131
131
var userId = req . user . _id ;
132
132
133
- < % if ( filters . mongooseModels ) { % > User . findOne ( { _id : userId } , '-salt -password' ) . exec ( ) < % }
134
- if ( filters . sequelizeModels ) { % > User . find ( {
133
+ < % if ( filters . mongooseModels ) { % > return User . findOne ( { _id : userId } , '-salt -password' ) . exec ( ) < % }
134
+ if ( filters . sequelizeModels ) { % > return User . find ( {
135
135
where : {
136
136
_id : userId
137
137
} ,
0 commit comments