11const userService = require ( '../services/userService.js' ) ;
22const authService = require ( '../services/authService.js' ) ;
3+
4+ const { BusinessError } = require ( '../services/errors/BusinessError.js' ) ;
5+
36module . exports = {
47
58 search : async function ( req , res ) {
@@ -10,13 +13,13 @@ module.exports = {
1013 // Only allowed fields are Searchable
1114 for ( let key of keys ) {
1215 if ( ! valids . includes ( key ) )
13- throw new BusinessError ( `${ key } λ κ²μν μλ μλ μμ±μ
λλ€.` ) ;
16+ throw new BusinessError ( `Query invalid: ${ key } λ κ²μν μλ μλ μμ±μ
λλ€.` ) ;
1417 }
1518
1619
1720 const projection = {
18- _id : true , name : true , rank : true , status : true , profileImageUrl : true ,
19- group : true , email : true , tel : true , lastLogin : true
21+ _id : true , name : true , rank : true , status : true ,
22+ group : true , email : true , tel : true , lastLogin : true , profileImageUrl : true , title : true
2023 } ;
2124
2225 try {
@@ -31,8 +34,8 @@ module.exports = {
3134
3235 let projection = {
3336 _id : true , serviceNumber :true , name : true , rank : true , title :true ,
34- status : true , group : true , email : true , tel : true , profileImageUrl : true ,
35- lastLogin : true , firseLogin :true , bookmarks : true , subscriptions : true
37+ status : true , group : true , email : true , tel : true , lastLogin : true ,
38+ lastLogin : true , firseLogin :true , bookmarks : true , subscriptions : true , profileImageUrl : true
3639 } ;
3740
3841 try {
@@ -71,7 +74,7 @@ module.exports = {
7174 // Only allowed fields are Searchable
7275 for ( let key of keys ) {
7376 if ( ! valids . includes ( key ) )
74- throw new BusinessError ( `${ key } λ Userμ μ‘΄μ¬νμ§ μκ±°λ, λ³κ²½ν μ μλ μμ±μ
λλ€` ) ;
77+ throw new BusinessError ( `Query invalid: ${ key } λ Userμ μ‘΄μ¬νμ§ μκ±°λ, λ³κ²½ν μ μλ μμ±μ
λλ€` ) ;
7578 }
7679
7780 await authService . editUserAuth ( res . locals . _id . toString ( ) , req . params . id ) ;
0 commit comments