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);
8
8
9
9
// Book Schema
10
10
function BookData ( data ) {
11
+ this . id = data . _id ;
11
12
this . title = data . title ;
12
13
this . description = data . description ;
13
14
this . isbn = data . isbn ;
@@ -23,7 +24,7 @@ exports.bookList = [
23
24
auth ,
24
25
function ( req , res ) {
25
26
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 ) => {
27
28
if ( books . length > 0 ) {
28
29
return apiResponse . successResponseWithData ( res , "Operation success" , books ) ;
29
30
} else {
@@ -51,7 +52,7 @@ exports.bookDetail = [
51
52
return apiResponse . successResponseWithData ( res , "Operation success" , { } ) ;
52
53
}
53
54
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 ) => {
55
56
if ( book !== null ) {
56
57
let bookData = new BookData ( book ) ;
57
58
return apiResponse . successResponseWithData ( res , "Operation success" , bookData ) ;
You can’t perform that action at this time.
0 commit comments