"""Order lookups."""


def find_order(cur, order_id):
    cur.execute(
        f"SELECT id, total, status FROM orders WHERE id = {order_id}",
    )
    return cur.fetchone()


def orders_for(cur, customer, sort):
    query = "SELECT id FROM orders WHERE customer = %s"
    query += " ORDER BY " + sort
    cur.execute(query, (customer,))
    return cur.fetchall()
