Skip to content

Commit 1247820

Browse files
Fixed dailyregister and product add/remove methods.
1 parent 6e3a20d commit 1247820

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

apihttp/src/main/java/apihttp/ApiHTTPService.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import java.math.BigDecimal;
1010
import java.time.LocalDate;
1111
import java.time.LocalDateTime;
12+
import java.util.ArrayList;
1213
import java.util.LinkedHashMap;
1314
import java.util.List;
1415
import java.util.Map;
@@ -263,7 +264,13 @@ public void kitchenNotification(int ordID)
263264
List<Order> getOrders(int userID)
264265
{
265266
User u = DU.getUser(userID);
266-
return u.getUserOrderList();
267+
List<Integer> userOrdersId = u.getUserOrderList();
268+
List<Order> userOrders = new ArrayList<Order>();
269+
for(Integer oID : userOrdersId)
270+
{
271+
userOrders.add(DO.getOrder(oID.intValue()));
272+
}
273+
return userOrders;
267274
}
268275

269276
/**

apihttp/src/main/java/apihttp/OrderController.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,6 @@ public Order getOrder(@PathVariable("orderid") int orderid)
5252
* @param ordid The id of a current Order which the product will be added.
5353
* @throws InsufficientStockException
5454
*/
55-
/*@PutMapping("/addproduct/{ordid}")
56-
public void addProductToOrder(@RequestBody Map<Integer,Integer> pq, @PathVariable("ordid") int ordid) throws InsufficientStockException
57-
{
58-
Map.Entry<Integer, Integer> entry = pq.entrySet().iterator().next();
59-
APIService.addProductToOrder(ordid, entry.getKey().intValue(), entry.getValue().intValue());
60-
}*/
61-
6255
@PutMapping("/addproduct/{ordid}")
6356
public void addProductToOrder(int productId, int quantity, @PathVariable("ordid") int ordid) throws InsufficientStockException
6457
{

0 commit comments

Comments
 (0)