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

async function testQuery() {
    const targetId = 'ORD/20260121-065/GZ06';
    console.log(`Searching for: ${targetId}`);

    try {
        const order = await Order.findOne({
            where: {
                [Op.or]: [
                    { invoice_number: targetId },
                    { order_number: targetId }
                ]
            }
        });

        if (order) {
            console.log("FOUND!");
            console.log(`ID: ${order.id}`);
            console.log(`Order#: ${order.order_number}`);
        } else {
            console.log("NOT FOUND");
        }
    } catch (error) {
        console.error("Error:", error);
    }
}

testQuery();
