File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,14 @@ export default {
6666 isAuthenticated ,
6767 isMessageOwner ,
6868 async ( parent , { id } , { models } ) => {
69- return await models . Message . findOneAndDelete ( { _id : id } ) ;
69+ const message = await models . Message . findById ( id ) ;
70+
71+ if ( message ) {
72+ await message . remove ( ) ;
73+ return true ;
74+ } else {
75+ return false ;
76+ }
7077 } ,
7178 ) ,
7279 } ,
Original file line number Diff line number Diff line change @@ -79,9 +79,14 @@ export default {
7979 deleteUser : combineResolvers (
8080 isAdmin ,
8181 async ( parent , { id } , { models } ) => {
82- return await models . User . findOneAndDelete ( { _id : id } ) . then (
83- ( ) => true ,
84- ) ;
82+ const user = await models . User . findById ( id ) ;
83+
84+ if ( user ) {
85+ await user . remove ( ) ;
86+ return true ;
87+ } else {
88+ return false ;
89+ }
8590 } ,
8691 ) ,
8792 } ,
You can’t perform that action at this time.
0 commit comments