from app.database import get_db_connection def create_order( customer_name: str, customer_phone: str, customer_address: str, customer_comment: str, order_items: str, total_price: int, ) -> None: conn = get_db_connection() conn.execute( """ INSERT INTO orders ( customer_name, customer_phone, customer_address, customer_comment, order_items, total_price ) VALUES (?, ?, ?, ?, ?, ?) """, ( customer_name, customer_phone, customer_address, customer_comment, order_items, total_price, ), ) conn.commit() conn.close() def get_all_orders(): conn = get_db_connection() orders = conn.execute("SELECT * FROM orders ORDER BY order_date DESC").fetchall() conn.close() return orders def update_order_status(order_id: int, status: str) -> None: conn = get_db_connection() conn.execute("UPDATE orders SET status = ? WHERE id = ?", (status, order_id)) conn.commit() conn.close()