Skip to content

Commit

Permalink
[修改] 新增訂單時 populate roomId
Browse files Browse the repository at this point in the history
  • Loading branch information
ptp_ting-xuan committed Oct 31, 2023
1 parent 8c3ae13 commit 9f426e6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/controllers/order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ export const createOneOrder: RequestHandler = async (req, res, next) => {
userInfo
});

await result.populate({
path: 'roomId'
});

res.send({
status: true,
result
Expand Down
19 changes: 18 additions & 1 deletion src/routes/api/v1/orders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,24 @@ router.post(
schema: {
"status": true,
"result": {
"roomId": "65251f6095429cd58654bf12",
"roomId": {
"_id": "65251f6095429cd58654bf12",
"name": "尊爵雙人房",
"description": "享受高級的住宿體驗,尊爵雙人房提供給您舒適寬敞的空間和精緻的裝潢。",
"content": "私人衛浴 • 市景 • 免費盥洗用品 • 淋浴間 • 空調 • 毛巾 • 床單 • 床邊插座....",
"imageUrl": "https://fakeimg.pl/300/",
"imageUrlList": [
"https://fakeimg.pl/300/",
"https://fakeimg.pl/300/",
"https://fakeimg.pl/300/"
],
"areaInfo": "24坪",
"bedInfo": "一張大床",
"maxPeople": 4,
"price": 10000,
"createdAt": "2023-10-10T09:54:40.063Z",
"updatedAt": "2023-10-10T09:54:40.063Z"
},
"checkInDate": "2023-06-17T16:00:00.000Z",
"checkOutDate": "2023-06-18T16:00:00.000Z",
"peopleNum": 2,
Expand Down

0 comments on commit 9f426e6

Please sign in to comment.