File tree 2 files changed +5
-7
lines changed
2 files changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -219,18 +219,17 @@ function UserController() {
219
219
this . unfollowSharkWallet = async ( req , res , next ) => {
220
220
let { userId, sharkId } = req . body ;
221
221
222
- if ( ! userId ) userId = null ;
222
+ if ( ! userId || _ . isEmpty ( userId ) ) userId = null ;
223
223
else {
224
224
if ( isNaN ( userId ) ) userId = undefined ;
225
225
else userId = Number ( userId ) ;
226
226
}
227
227
228
- if ( ! sharkId ) sharkId = null ;
228
+ if ( ! sharkId || _ . isEmpty ( sharkId ) ) sharkId = null ;
229
229
else {
230
230
if ( isNaN ( sharkId ) ) sharkId = undefined ;
231
231
else sharkId = Number ( sharkId ) ;
232
232
}
233
-
234
233
await unfollowWalletOfShark ( userId , sharkId )
235
234
. then ( ( data ) => {
236
235
if ( data . message === "success" )
Original file line number Diff line number Diff line change @@ -239,8 +239,8 @@ const followWalletOfShark = async (userId, sharkId) => {
239
239
240
240
const unfollowWalletOfShark = async ( userId , sharkId ) => {
241
241
try {
242
- if ( userId === null ) return "userid-required" ;
243
- if ( userId === undefined ) return "userid-invalid" ;
242
+ if ( userId === null ) return { message : "userid-required" } ;
243
+ if ( userId === undefined ) return { message : "userid-invalid" } ;
244
244
if ( sharkId === null ) return { message : "sharkid-required" } ;
245
245
if ( sharkId === undefined ) return { message : "sharkid-invalid" } ;
246
246
@@ -271,7 +271,6 @@ const unfollowWalletOfShark = async (userId, sharkId) => {
271
271
272
272
return {
273
273
message : "success" ,
274
- data : { ...shark , unfollowed : true }
275
274
} ;
276
275
} catch ( error ) {
277
276
return { message : "error-unfollow-failed" , error : error } ;
@@ -348,7 +347,7 @@ const getTransactionsOfAllSharks = async (page, valueFilter = 0) => {
348
347
. sort ( { timeStamp : "desc" } )
349
348
. skip ( ( page - 1 ) * QUERY_LIMIT_ITEM )
350
349
. limit ( QUERY_LIMIT_ITEM ) ;
351
-
350
+
352
351
return transactions || [ ] ;
353
352
} ;
354
353
You can’t perform that action at this time.
0 commit comments