File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ mongoose.set("useFindAndModify", false);
88
99// Book Schema
1010function BookData ( data ) {
11+ this . id = data . _id ;
1112 this . title = data . title ;
1213 this . description = data . description ;
1314 this . isbn = data . isbn ;
@@ -23,7 +24,7 @@ exports.bookList = [
2324 auth ,
2425 function ( req , res ) {
2526 try {
26- Book . find ( { user : req . user . _id } , "title description isbn createdAt" ) . then ( ( books ) => {
27+ Book . find ( { user : req . user . _id } , "_id title description isbn createdAt" ) . then ( ( books ) => {
2728 if ( books . length > 0 ) {
2829 return apiResponse . successResponseWithData ( res , "Operation success" , books ) ;
2930 } else {
@@ -51,7 +52,7 @@ exports.bookDetail = [
5152 return apiResponse . successResponseWithData ( res , "Operation success" , { } ) ;
5253 }
5354 try {
54- Book . findOne ( { _id : req . params . id , user : req . user . _id } , "title description isbn createdAt" ) . then ( ( book ) => {
55+ Book . findOne ( { _id : req . params . id , user : req . user . _id } , "_id title description isbn createdAt" ) . then ( ( book ) => {
5556 if ( book !== null ) {
5657 let bookData = new BookData ( book ) ;
5758 return apiResponse . successResponseWithData ( res , "Operation success" , bookData ) ;
You can’t perform that action at this time.
0 commit comments