Exemple #1
0
def get(order_id):
    """
    Get item from id
    """
    coll = Order.collection()
    dic = coll.find_one({"_id": order_id})
    return Order.unserialize(dic) if dic is not None else None
Exemple #2
0
def new(user_id):
    o = Order()
    o.user_id = user_id
    o.status = OrderStatus.NEW
    return o
Exemple #3
0
def get_all(user_id):
    coll = Order.collection()
    dic_lis = coll.find({
        "user_id": user_id
    })
    return [Order.unserialize(d) for d in dic_lis]