@@ -25,8 +25,8 @@ function handleError(res, statusCode) {
2525 * restriction: 'admin'
2626 */
2727export 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 ( {
3030 attributes : [
3131 '_id' ,
3232 'name' ,
@@ -52,7 +52,7 @@ export function create(req, res, next) {
5252 if ( filters . sequelizeModels ) { % > var newUser = User . build ( req . body ) ;
5353 newUser . setDataValue ( 'provider' , 'local' ) ;
5454 newUser . setDataValue ( 'role' , 'user' ) ;
55- newUser . save ( ) < % } % >
55+ return newUser . save ( ) < % } % >
5656 . then ( function ( user ) {
5757 var token = jwt . sign ( { _id : user . _id } , config . secrets . session , {
5858 expiresIn : 60 * 60 * 5
@@ -68,8 +68,8 @@ export function create(req, res, next) {
6868export function show ( req , res , next ) {
6969 var userId = req . params . id ;
7070
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 ( {
7373 where : {
7474 _id : userId
7575 }
@@ -88,8 +88,8 @@ export function show(req, res, next) {
8888 * restriction: 'admin'
8989 */
9090export 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 } ) < % } % >
9393 . then ( function ( ) {
9494 res . status ( 204 ) . end ( ) ;
9595 } )
@@ -104,8 +104,8 @@ export function changePassword(req, res, next) {
104104 var oldPass = String ( req . body . oldPassword ) ;
105105 var newPass = String ( req . body . newPassword ) ;
106106
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 ( {
109109 where : {
110110 _id : userId
111111 }
@@ -130,8 +130,8 @@ export function changePassword(req, res, next) {
130130export function me ( req , res , next ) {
131131 var userId = req . user . _id ;
132132
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 ( {
135135 where : {
136136 _id : userId
137137 } ,
0 commit comments