Skip to content

Commit 171f8e3

Browse files
committedSep 7, 2020
🐛 fix: Remove unnecessary data from dishRestDetails end point response
1 parent d09f15f commit 171f8e3

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed
 

‎routes/endpoints.js

+11-3
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,22 @@ router.post
2525
.get()
2626
.then((querySnapshot) => querySnapshot.data());
2727

28-
dishDetails = { id: dishId, ...dishDetails}
28+
const rest_id = dishDetails.rest_id;
29+
30+
dishDetails = {
31+
id: dishId,
32+
name: dishDetails.name,
33+
price: dishDetails.price
34+
};
2935

30-
const restDetails = await firestore
36+
let restDetails = await firestore
3137
.collection("restaurants")
32-
.doc(dishDetails.rest_id)
38+
.doc(rest_id)
3339
.get()
3440
.then((querySnapshot) => querySnapshot.data());
3541

42+
restDetails = { name: restDetails.name };
43+
3644
details.push({ dishDetails, restDetails });
3745
}
3846

0 commit comments

Comments
 (0)
Please sign in to comment.