diff --git a/API_GatewayWeb/HTTP_API/Order.go b/API_GatewayWeb/HTTP_API/Order.go index 5755dd6..2d5a128 100644 --- a/API_GatewayWeb/HTTP_API/Order.go +++ b/API_GatewayWeb/HTTP_API/Order.go @@ -40,7 +40,14 @@ func (a *Controller) updateOrder(ctx *gin.Context) { return } - confirmation, err := a.logic.UpdateOrder(ctx.Request.Context(), id) + var order DataStructures.Order + err = ctx.BindJSON(&order) + if err != nil { + ctx.JSON(400, gin.H{"error": err.Error()}) + return + } + + confirmation, err := a.logic.UpdateOrder(ctx.Request.Context(), id, order) if err != nil { ctx.JSON(500, gin.H{"error": err.Error()}) return diff --git a/API_GatewayWeb/Logic/Order.go b/API_GatewayWeb/Logic/Order.go index 5ab06d5..ff31bb5 100644 --- a/API_GatewayWeb/Logic/Order.go +++ b/API_GatewayWeb/Logic/Order.go @@ -62,8 +62,11 @@ func (c *Controller) CreateOrder(ctx context.Context, order DataStructures.Order return } -func (c *Controller) UpdateOrder(ctx context.Context, id primitive.ObjectID) (confirmation *pb.Confirmation, err error) { - confirmation, err = c.grpc.Client.UpdateOrder(ctx, &pb.Order{Id: id.Hex()}) +func (c *Controller) UpdateOrder(ctx context.Context, id primitive.ObjectID, order DataStructures.Order) (confirmation *pb.Confirmation, err error) { + + orderGrpc := Converter.ConvertOrderToGrpc(order) + + confirmation, err = c.grpc.Client.UpdateOrder(ctx, orderGrpc) if err != nil { fmt.Println(err.Error()) return