|
| 1 | +I. Viewing list of Stores (and selecting the "current" one at the UI side). |
| 2 | + |
| 3 | +GET /api/inventory/stores - list of all active stores (ordered by ordinal number) |
| 4 | + /api/inventory/stores/show/all - also include inactive ones (ordered by ordinal number) |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | +II. Searching for Products with an appropriate name. |
| 9 | + |
| 10 | +GET /api/inventory/find-products/<name-beginning>/at-store/<store-id> - list all Products at a given store; search by beginning of the name (order by name) |
| 11 | +example: /api/inventory/find-products/name%2012/at-store/2 |
| 12 | +[ |
| 13 | + { |
| 14 | + "name": "shirt 1234", |
| 15 | + "purchasePrice": 14.0, |
| 16 | + "retailPrice": 16.0, |
| 17 | + "inStock": 1 |
| 18 | + }, |
| 19 | + { |
| 20 | + "name": "shirt 1246", |
| 21 | + "purchasePrice": 14.5, |
| 22 | + "retailPrice": 17.0, |
| 23 | + "inStock": 3 |
| 24 | + } |
| 25 | +] |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | +III. Getting Product IDs and purchase prices for one exact name. |
| 30 | + |
| 31 | +GET /api/inventory/product-ids-for/<name>/at-store/<store-id> |
| 32 | +example: /api/inventory/product-ids-for/shirt%201234/at-store/2 |
| 33 | +[ |
| 34 | + { |
| 35 | + "id": 34562, |
| 36 | + "purchasePrice": 13.5 |
| 37 | + }, |
| 38 | + { |
| 39 | + "id": 954560, |
| 40 | + "purchasePrice": 14.0 |
| 41 | + } |
| 42 | +] |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | +IV. Getting Product details with stocks at a given Store. |
| 47 | + |
| 48 | +GET /api/inventory/products/<id>/at-store/<store-id> |
| 49 | +example: /api/inventory/products/1080/at-store/3 |
| 50 | +{ |
| 51 | + "id": 1080, |
| 52 | + "name": "suit 56", |
| 53 | + "sizeChartId": 3, |
| 54 | + "purchasePrice": 20.0, |
| 55 | + "retailPrice": 26.0, |
| 56 | + "modified": "2020-12-25T17:25:00", |
| 57 | + "stocks": [ |
| 58 | + [0, 0, 0, 0, 0, 1, 0, 3], |
| 59 | + [0, 0, 0, 0, 0, 0, 0, 0], |
| 60 | + [0, 0, 0, 0, 0, 0, 0, 0], |
| 61 | + [0, 0, 0, 0, 0, 0, 0, 0], |
| 62 | + [0, 0, 0, 4, 0, 0, 0, 0], |
| 63 | + [0, 0, 0, 0, 0, 0, 0, 0], |
| 64 | + [0, 0, 0, 0, 0, 2, 0, 0], |
| 65 | + [0, 0, 0, 0, 0, 0, 0, 0], |
| 66 | + [0, 0, 0, 0, 0, 0, 0, 0], |
| 67 | + [0, 0, 0, 0, 0, 0, 0, 0] |
| 68 | + ] |
| 69 | +} |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | +V. Getting a Size chart. |
| 74 | + |
| 75 | +GET /api/inventory/size-charts/ - list all existing IDs |
| 76 | +GET /api/inventory/size-charts/<id> - get details of the specified size chart |
| 77 | +example: /api/inventory/size-charts/4 |
| 78 | +{ |
| 79 | + "name": "shirt" |
| 80 | + "cellsX": "164/170,170/176,176,176/182,184,182/188,188/194,Defective (0)", |
| 81 | + "cellsY": "36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53" |
| 82 | +} |
| 83 | + |
| 84 | + |
| 85 | + |
| 86 | +VI. Save Product details: retail price and/or stocks (the latter one - at a given Store). |
| 87 | + |
| 88 | +6.1) Create a new Product. |
| 89 | + |
| 90 | +POST /api/inventory/products/ |
| 91 | +example: /api/inventory/products/ |
| 92 | +{ |
| 93 | + "name": "suit 1342", |
| 94 | + "sizeChartId": 2, |
| 95 | + "purchasePrice": 14.0, |
| 96 | + "retailPrice": 19.99 |
| 97 | +} |
| 98 | +will be returned: id of the new Product |
| 99 | + |
| 100 | +Note: "sizeChartId" may (and should) be omitted if we create a variant of the existing Product |
| 101 | +with a new purchase price. |
| 102 | + |
| 103 | +6.2) Update Product retail price. |
| 104 | + |
| 105 | +PUT /api/inventory/products/<id> |
| 106 | +example: /api/inventory/products/6892 |
| 107 | +{ |
| 108 | + "retailPrice": 21.99 |
| 109 | +} |
| 110 | + |
| 111 | +6.3) Set/update Product stocks for the given Store. |
| 112 | + |
| 113 | +PUT /api/inventory/products/<id>/at-store/<store-id> |
| 114 | +example: /api/inventory/products/567/at-store/3 |
| 115 | +{ |
| 116 | + "stocks": [ |
| 117 | + [0, 0, 0, 0, 0, 1, 0, 3], |
| 118 | + [0, 0, 0, 0, 0, 0, 0, 0], |
| 119 | + [0, 0, 0, 0, 0, 0, 0, 0], |
| 120 | + [0, 0, 0, 0, 0, 0, 0, 0], |
| 121 | + [0, 0, 0, 4, 0, 0, 0, 0], |
| 122 | + [0, 0, 0, 0, 0, 0, 0, 0], |
| 123 | + [0, 0, 0, 0, 0, 2, 0, 0], |
| 124 | + [0, 0, 0, 0, 0, 0, 0, 0], |
| 125 | + [0, 0, 0, 0, 0, 0, 0, 0], |
| 126 | + [0, 0, 0, 0, 0, 0, 0, 0] |
| 127 | + ] |
| 128 | +} |
| 129 | + |
| 130 | + |
| 131 | + |
| 132 | +VII. Remove all Product stocks from the Store. |
| 133 | + |
| 134 | +DELETE /api/inventory/products/<id>/from-store/<store-id> |
| 135 | + |
| 136 | +Note: If, after removing stocks at the given Store, there will not be any stock of |
| 137 | +this Product at other Stores, the Product itself will be removed from the database too. |
| 138 | + |
| 139 | + |
| 140 | + |
| 141 | +VIII. Move Product stocks from one Store to another. |
| 142 | + |
| 143 | +POST /api/inventory/move/<product-id> |
| 144 | +params (with example values): |
| 145 | +{ |
| 146 | + "sourceStoreId": 2, |
| 147 | + "destinationStoreId": 1, |
| 148 | + "cellX": "167", |
| 149 | + "cellY": "60", |
| 150 | + "units": 1 |
| 151 | +} |
| 152 | + |
| 153 | +This method is atomic and non-idempotent. |
| 154 | + |
| 155 | + |
| 156 | + |
| 157 | +IV. Inventory report. |
| 158 | + |
| 159 | +GET /api/inventory/report |
| 160 | +Optional URL parameters: |
| 161 | +at-store/<store-id> - limit report by the store (otherwise, all stores will be included) |
| 162 | +product-name-begins/<product-name-beginning> - limit by first letters in the Product name |
| 163 | +show-purchase-prices/<true-or-false> |
| 164 | +show-retail-prices/<true-or-false> |
| 165 | +show-stock-prices/<true-or-false> - show the overall purchase cost of all those Products in stock |
| 166 | +detail-sizes/<true-or-false> - show detailed stock by sizes |
| 167 | + |
| 168 | + |
| 169 | + |
| 170 | + |
| 171 | +брюки 125580/3 16 06 20 |
0 commit comments