{"info":{"title":"Nory Middleware - Sandbox Environment","version":"1.0.0","description":"Nory "},"servers":["https://sandbox.nory.ai","http://localhost:8000"],"basePath":"/app/v1/","schemes":["https","http"],"securityDefinitions":{"bearerAuth":{"type":"apiKey","name":"Authorization","scheme":"bearer","in":"header"}},"swagger":"2.0","paths":{"/auth/token":{"post":{"tags":["Authorization"],"name":"Token","summary":"Get Access and Refresh tokens","produces":["application/json"],"consumes":["application/json"],"parameters":[{"name":"body","in":"body","schema":{"type":"object","properties":{"email":{"type":"string"},"password":{"type":"string","format":"password"}}},"required":["email","password"]}],"responses":{"200":{"description":"Token Sucess"},"401":{"description":"Bad username, not found in db"},"403":{"description":"Username and password don't match"}}}},"/auth/refreshToken":{"post":{"tags":["Refresh token"],"name":"Refresh Token","summary":"Get new Access Token by passing Refresh Token, pass the RefershToken along with authorization headers","security":[{"bearerAuth":[]}],"produces":["application/json"],"consumes":["application/json"],"responses":{"200":{"description":"Token Sucess"},"401":{"description":"Bad username, not found in db"},"403":{"description":"Username and password don't match"}}}},"/branches/{id}":{"get":{"tags":["Branch"],"name":"Get Branch","summary":"Get Branch associated with the User","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"path","name":"id","schema":{"type":"string"},"required":["name"]}],"responses":{"200":{"description":"A single branch object","schema":null},"401":{"description":"No auth token"},"403":{"description":"JWT token invalid"}}}},"/brands/brand":{"get":{"tags":["Brands"],"name":"Get Brand","summary":"Get Brand associated with the User","security":[{"bearerAuth":[]}],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"query","name":"brandname","schema":{"type":"string"},"required":["name"]}],"responses":{"200":{"description":"A single brand object","schema":null},"401":{"description":"No auth token"},"403":{"description":"JWT token and username from client don't match"}}}},"/integration/{id}/{integrationName}/{type}":{"get":{"tags":["Integration"],"name":"Get Integration Data","summary":"Get Data from Integration service","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"path","name":"id","schema":{"type":"string"},"required":["name"]},{"in":"path","name":"integrationName","schema":{"type":"string"},"required":["name"]},{"in":"path","name":"type","schema":{"type":"string"},"required":["name"]},{"in":"query","name":"from","schema":{"type":"string"},"required":["name"]},{"in":"query","name":"to","schema":{"type":"string"},"required":["name"]}],"responses":{"200":{"description":"Requested data","schema":null},"401":{"description":"Permission error"},"500":{"description":"Internal server error"}}}},"/inventory/ingest":{"post":{"tags":["Inventory"],"name":"Ingest","summary":"Ingest items / batch items / menu items","security":[{"bearerAuth":[]}],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"body","schema":{"$ref":"#/definitions/Ingest"}}],"responses":{"200":{"description":"Successful ingest message","schema":{"type":"object","properties":{"status":{"type":"string"},"data":{"type":"string"}}}},"400":{"description":"Incorrect data supplied","schema":{"type":"object","properties":{"error":{"type":"object"}}}},"401":{"description":"No auth token"},"403":{"description":"JWT token and username from client don't match"}}}},"/inventory/branches/{branchId}/counts":{"get":{"tags":["Inventory"],"name":"Counts","summary":"Get counts of a branch","security":[{"bearerAuth":[]}],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"path","name":"branchId","schema":"string"}],"responses":{"200":{"description":"List of counts","schema":{"type":"object","properties":{"counts":{"type":"array","items":{"$ref":"#/definitions/Count"}}}}},"400":{"description":"Incorrect data supplied"},"401":{"description":"No auth token"},"403":{"description":"JWT token and username from client don't match"}}},"post":{"tags":["Inventory"],"name":"Counts","summary":"Create a count","security":[{"bearerAuth":[]}],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"path","name":"branchId","schema":"string"},{"in":"body","name":"body","schema":{"$ref":"#/definitions/Count"}}],"responses":{"200":{"description":"Created count","schema":{"type":"object","properties":{"count":{"$ref":"#/definitions/Count"}}}},"400":{"description":"Incorrect data supplied"},"401":{"description":"No auth token"},"403":{"description":"JWT token and username from client don't match"},"500":{"description":"Unexpected error"}}}},"/inventory/branches/{branchId}/deliveries":{"get":{"tags":["Inventory"],"name":"Deliveries","summary":"Get deliveries of a branch","security":[{"bearerAuth":[]}],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"path","name":"branchId","schema":"string"}],"responses":{"200":{"description":"List of deliveries","schema":{"type":"object","properties":{"deliveries":{"type":"array","items":{"$ref":"#/definitions/Delivery"}}}}},"400":{"description":"Incorrect data supplied"},"401":{"description":"No auth token"},"403":{"description":"JWT token and username from client don't match"}}}},"/inventory/suppliers":{"get":{"tags":["Inventory"],"name":"Suppliers","summary":"Get all suppliers","security":[{"bearerAuth":[]}],"consumes":["application/json"],"produces":["application/json"],"parameters":null,"responses":{"200":{"description":"List of suppliers","schema":{"type":"object","properties":{"suppliers":{"type":"array","items":{"$ref":"#/definitions/Supplier"}}}}},"400":{"description":"Incorrect data supplied"},"401":{"description":"No auth token"},"403":{"description":"JWT token and username from client don't match"}}}},"/inventory/brands/{brandId}/branches/{branchId}/recommended-order":{"get":{"tags":["Inventory Orders"],"name":"RecommendedOrders","summary":"Get recommended purchase orders for a branch","description":"Returns recommended orders based on demand forecasting. Maps to inventory.handlers.recommended_order.get_recommended_orders.","security":[{"bearerAuth":[]}],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"path","name":"brandId","required":true,"schema":{"type":"string"},"description":"External brand ID"},{"in":"path","name":"branchId","required":true,"schema":{"type":"string"},"description":"External branch ID"},{"in":"query","name":"start_date","required":false,"schema":{"type":"string","format":"date"},"description":"Start date for recommendations (defaults to today)"},{"in":"query","name":"end_date","required":false,"schema":{"type":"string","format":"date"},"description":"End date for recommendations (defaults to start_date + 14 days)"},{"in":"query","name":"operation","required":false,"schema":{"type":"string","enum":["retrieve","generate"]},"description":"Operation mode - \"retrieve\" returns cached orders, \"generate\" creates new recommendations (defaults to \"retrieve\"). Generate is deprecated - use POST instead."}],"responses":{"200":{"description":"JSON object containing the recommended orders and details of data they were based on"},"400":{"description":"Incorrect data supplied"},"401":{"description":"No auth token"},"403":{"description":"JWT token and username from client don't match"},"500":{"description":"Unexpected error"}}},"post":{"tags":["Inventory Orders"],"name":"GenerateRecommendedOrders","summary":"Generate recommended purchase orders for a branch","description":"Generates new recommended orders based on demand forecasting. Maps to inventory.handlers.recommended_order.generate_recommended_orders_handler.","security":[{"bearerAuth":[]}],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"path","name":"brandId","required":true,"schema":{"type":"string"},"description":"External brand ID"},{"in":"path","name":"branchId","required":true,"schema":{"type":"string"},"description":"External branch ID"},{"in":"query","name":"start_date","required":false,"schema":{"type":"string","format":"date"},"description":"Start date for recommendations (defaults to today)"},{"in":"query","name":"end_date","required":false,"schema":{"type":"string","format":"date"},"description":"End date for recommendations (defaults to start_date + 14 days)"}],"responses":{"200":{"description":"JSON object containing the generated recommended orders"},"401":{"description":"No auth token"},"403":{"description":"JWT token and username from client don't match"},"500":{"description":"Unexpected error"}}}},"/inventory/brands/{brandId}/branches/{branchId}/recommended-order/accept":{"post":{"tags":["Inventory Orders"],"name":"AcceptRecommendedOrder","summary":"Accept (or amend) a recommended order and create a purchase order","description":"Accepts a recommended order, optionally with edits, creates a PurchaseOrder linked to the recommended order, and returns the PO along with a classification (\"accepted\" when submitted quantities match the recommendation exactly, \"amended\" when the user edited them). Maps to inventory.handlers.recommended_order.recommended_order_accept_post.","security":[{"bearerAuth":[]}],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"path","name":"brandId","required":true,"schema":{"type":"string"},"description":"External brand ID"},{"in":"path","name":"branchId","required":true,"schema":{"type":"string"},"description":"External branch ID"}],"responses":{"200":{"description":"Object containing the created purchase_order and a classification of \"accepted\" or \"amended\""},"400":{"description":"Validation error"},"401":{"description":"No auth token"},"403":{"description":"JWT token and username from client don't match"},"404":{"description":"Recommended order not found or stale"},"409":{"description":"Recommended order is mid-creation or already submitted"},"500":{"description":"Unexpected error"}}}},"/inventory/brands/{brandId}/branches/{branchId}/recommended-order/draft":{"post":{"tags":["Inventory Orders"],"name":"DraftRecommendedOrder","summary":"Convert a recommended order into an editable draft purchase order","description":"Creates a PurchaseOrder from a recommended order as an editable draft. Nothing is sent to the supplier; the draft is classified against the recommendation on send. Maps to inventory.handlers.recommended_order.edit_recommended_order (recommended_order_edit_post).","security":[{"bearerAuth":[]}],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"path","name":"brandId","required":true,"schema":{"type":"string"},"description":"External brand ID"},{"in":"path","name":"branchId","required":true,"schema":{"type":"string"},"description":"External branch ID"}],"responses":{"200":{"description":"Object containing the created draft purchase_order and its classification"},"400":{"description":"Validation error"},"401":{"description":"No auth token"},"403":{"description":"JWT token and username from client don't match"},"404":{"description":"Recommended order not found or stale"},"409":{"description":"Recommended order is mid-creation or already submitted"},"500":{"description":"Unexpected error"}}}},"/punch/{id}":{"get":{"tags":["Employee Punch"],"name":"Get Punch by ID","summary":"Get Punch data","security":[{"bearerAuth":[]}],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"path","name":"id","schema":{"type":"string"},"required":["name"]}],"responses":{"200":{"description":"Requested data","schema":null},"401":{"description":"Permission error"},"500":{"description":"Internal server error"}}}},"/punch":{"get":{"tags":["Employee Punch"],"name":"Get Punch Data for Employee","summary":"Get Data from Labour service - Employee Punch information.","security":[{"bearerAuth":[]}],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"query","name":"employee_id","schema":{"type":"string"},"required":["name"]},{"in":"query","name":"limit","schema":{"type":"number"},"required":["name"]}],"responses":{"200":{"description":"Requested data","schema":null},"401":{"description":"Permission error"},"500":{"description":"Internal server error"}}}},"/settings/customHolidays/{id}":{"get":{"tags":["Location Settings"],"name":"Get custom holidays by ID","summary":"Get custom holidays for a location","security":[{"bearerAuth":[]}],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"path","name":"id","schema":{"type":"string"},"required":["name"]}],"responses":{"200":{"description":"Requested data","schema":null},"401":{"description":"Permission error"},"500":{"description":"Internal server error"}}},"post":{"tags":["Location Settings"],"name":"Create custom holidays for a location by ID","summary":"Create custom holidays for a location by ID","security":[{"bearerAuth":[]}],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"path","name":"id","schema":{"type":"string"}},{"in":"body","name":"body"}],"responses":{"204":{"description":"Requested data","schema":null},"400":{"description":"Bad request"},"401":{"description":"Permission error"},"500":{"description":"Internal server error"}}}},"/templates/{id}":{"get":{"tags":["Templates"],"name":"Get Templates","summary":"Get Templates for the branch","security":[{"bearerAuth":[]}],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"path","name":"id","schema":{"type":"string"}}],"responses":{"200":{"description":"Requested data","schema":null},"400":{"description":"Bad request"},"401":{"description":"Permission error"},"500":{"description":"Internal server error"}}}},"/templates/":{"post":{"tags":["Templates"],"name":"Create Template","summary":"Create Template for the branch","security":[{"bearerAuth":[]}],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"path","name":"id","schema":{"type":"string"}},{"in":"body","name":"body"}],"responses":{"204":{"description":"Requested data","schema":null},"400":{"description":"Bad request"},"401":{"description":"Permission error"},"500":{"description":"Internal server error"}}}},"/templates/{templateId}":{"delete":{"tags":["Templates"],"name":"Delete Template","summary":"Delete Template","security":[{"bearerAuth":[]}],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"path","name":"id","schema":{"type":"string"}},{"in":"path","name":"templateId","schema":{"type":"string"}}],"responses":{"204":{"description":"Action successful","schema":null},"400":{"description":"Bad request"},"401":{"description":"Permission error"},"500":{"description":"Internal server error"}}}},"/templates/apply":{"post":{"tags":["Templates"],"name":"Apply Template","summary":"Apply Template","security":[{"bearerAuth":[]}],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"path","name":"id","schema":{"type":"string"}},{"in":"body","name":"body"}],"responses":{"204":{"description":"Requested data","schema":null},"400":{"description":"Bad request"},"401":{"description":"Permission error"},"500":{"description":"Internal server error"}}}},"/templates/recommendation":{"post":{"tags":["Templates"],"name":"Request Template Recommendation","summary":"Request Template Recommendation","security":[{"bearerAuth":[]}],"consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"path","name":"id","schema":{"type":"string"}},{"in":"body","name":"body"}],"responses":{"204":{"description":"Requested data","schema":null},"400":{"description":"Bad request"},"401":{"description":"Permission error"},"500":{"description":"Internal server error"}}}}},"definitions":{"Ingest":{"type":"object","properties":{"brand_id":{"type":"string"},"ingest_type":{"type":"string"},"content":{"type":"string"}}},"BaseUnit":{"type":"object","properties":{"unit_of_measure":{"type":"number"}}},"Unit":{"type":"object","properties":{"unit_type":{"type":"string","enum":["base","package","case"]},"unit_body":{"$ref":"#/definitions/BaseUnit"}}},"BrandItemUnitCount":{"type":"object","properties":{"unit":{"type":"array","items":{"$ref":"#/definitions/Unit"}},"quantity":{"type":"number"}}},"BrandItemCount":{"type":"object","properties":{"brand_item":{"type":"string"},"unit_counts":{"type":"array","items":{"$ref":"#/definitions/BrandItemUnitCount"}}}},"Count":{"type":"object","properties":{"id":{"type":"string"},"created":{"type":"string","format":"date-time"},"modified":{"type":"string","format":"date-time"},"type":{"type":"string","enum":["full"]},"status":{"type":"string","enum":["draft","completed"]},"branch_id":{"type":"string"},"brand_item_counts":{"type":"array","items":{"$ref":"#/definitions/BrandItemCount"}}}},"RecommendedOrderItem":{"type":"object","properties":{"brand_item":{"type":"string","description":"Brand item BSON ID"},"order_quantity":{"type":"number"},"priority_score":{"type":"number"},"urgency":{"type":"string","enum":["high","medium","low"]},"unit":{"$ref":"#/definitions/Unit"},"order_date":{"type":"string","format":"date"},"cut_off_time":{"type":"string"},"delivery_date":{"type":"string","format":"date"},"run_out_date":{"type":"string","format":"date"}}},"RecommendedOrder":{"type":"object","properties":{"id":{"type":"string"},"branch":{"type":"string","description":"Branch BSON ID"},"supplier":{"type":"string","description":"Supplier BSON ID"},"delivery_date":{"type":"string","format":"date"},"delivery_slot":{"type":"string"},"status":{"type":"string"},"items":{"type":"array","items":{"$ref":"#/definitions/RecommendedOrderItem"}}}}},"responses":{},"parameters":{},"tags":[]}