Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GET /items : 取得物品搜尋清單 #42

Open
Chun-Cheng opened this issue May 3, 2024 — with Linear · 1 comment
Open

GET /items : 取得物品搜尋清單 #42

Chun-Cheng opened this issue May 3, 2024 — with Linear · 1 comment
Assignees

Comments

Copy link
Contributor

Chun-Cheng commented May 3, 2024

輸入與輸出

  • parameters
    • item_id (query)
      物品 _id
      string, optional
      format: Object ID /^[a-fA-F0-9]{24}$/
      example: "65f48bbc6f21a65d302a6147"
  • response
    • status: 200 OK
      content: application/json

      if item_id was given, it'll return an object. Otherwise, it'll return an array.

      if item_id === undefined:

      • data: Array
        • _id: Object ID, 物品 _id
        • name: Object, 物品名稱
          • zh-tw: string, 物品中文名稱
          • en: string, item English name
        • quantity: integer, 物品數量
        • exception_time: Array
          • ......

      if item_id !== undefined:

      • _id: Object ID, 物品 _id
      • name: Object, 物品名稱
        • zh-tw: string, 物品中文名稱
        • en: string, item English name
      • quantity: integer, 物品數量
      • exception_time: Array
        • ......

      example: item_id: undefined

      {
        "data": [
          {
            "_id": "65f48bbc6f21a65d302a6147",
            "name": {
              "zh-tw": "塑膠椅",
              "en": "Plastic Chairs"
            },
            "quantity": 30,
            "exception_time": []
          },
          {
            "_id": "65f48bbc6f21a65d302a6148",
            "name": {
              "zh-tw": "長桌",
              "en": "Tables"
            },
            "quantity": 2,
            "exception_time": []
          }
        ]
      }
      
      

      item_id: "65f48bbc6f21a65d302a6147"

      {
        {
          "_id": "65f48bbc6f21a65d302a6147",
          "name": {
            "zh-tw": "塑膠椅",
            "en": "Plastic Chairs"
          },
          "quantity": 30,
          "exception_time": []
        }
      }
      
      
    • status: 404 Not found content: application/json

      • error_code: string, 錯誤代碼
      • message: string, 提示訊息

      example:

      {
        "error_code": "R_ID_NOT_FOUND", 
        "message": "Item ID not found"
      }
      

檔案

  • /routes/reserve/get_items.js

資料集

  • items
@Chun-Cheng Chun-Cheng added the Improvement label May 3, 2024 — with Linear
Copy link

linear bot commented May 3, 2024

@Chun-Cheng Chun-Cheng self-assigned this Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant