Skip to content

Commit

Permalink
initial creation of order
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Mar 17, 2016
1 parent 668358f commit e32b67e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
12 changes: 10 additions & 2 deletions src/budy/controllers/api/bag.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ def show(self, key):
country = self.country
)
bag = bag.reload(
key = key,
eager = ("lines", "lines.product"),
map = True
)
Expand All @@ -91,7 +90,6 @@ def merge(self, key, target):
target = budy.Bag.get(key = target)
bag.merge_s(target.id, increment = increment)
bag = bag.reload(
key = key,
eager = ("lines", "lines.product"),
map = True
)
Expand Down Expand Up @@ -130,3 +128,13 @@ def add_update_line(self, key):
map = True
)
return line

@appier.route("/api/bags/<str:key>/order", "GET", json = True)
def order(self, key):
bag = budy.Bag.get(key = key)
order = bag.to_order_s()
order = order.reload(
eager = ("lines", "lines.product"),
map = True
)
return order
4 changes: 2 additions & 2 deletions src/budy/models/order.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@

import appier

from . import base
from . import bundle
from . import order_line

class Order(base.BudyBase):
class Order(bundle.Bundle):

lines = appier.field(
type = appier.references(
Expand Down

0 comments on commit e32b67e

Please sign in to comment.