19 lines
531 B
Python
19 lines
531 B
Python
|
|
from flask import Blueprint, render_template
|
||
|
|
from server.database import get_db
|
||
|
|
|
||
|
|
bp = Blueprint('orders', __name__, url_prefix='/orders')
|
||
|
|
|
||
|
|
|
||
|
|
@bp.route('/')
|
||
|
|
def list_orders():
|
||
|
|
db = get_db()
|
||
|
|
orders = db.execute('''
|
||
|
|
SELECT o.*, a.name as account_name, t.target_url, t.snatch_time
|
||
|
|
FROM orders o
|
||
|
|
LEFT JOIN accounts a ON o.account_id = a.id
|
||
|
|
LEFT JOIN tasks t ON o.task_id = t.id
|
||
|
|
ORDER BY o.id DESC
|
||
|
|
''').fetchall()
|
||
|
|
db.close()
|
||
|
|
return render_template('orders.html', orders=orders)
|