const { Order } = require('./models');

async function listOrders() {
    try {
        const orders = await Order.findAll({
            attributes: ['id', 'order_number', 'invoice_number', 'createdAt'],
            order: [['createdAt', 'DESC']],
            limit: 5
        });

        console.log("Recent Orders:");
        orders.forEach(o => {
            console.log(`ID: ${o.id}, Order#: ${o.order_number}, Invoice#: ${o.invoice_number}`);
        });
    } catch (error) {
        console.error("Error listing orders:", error);
    }
}

listOrders();
