"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.shippingProviders = void 0;
const typeorm_1 = require("typeorm");
const sales_base_1 = require("@things-factory/sales-base");
exports.shippingProviders = {
    async shippingProviders(_, params, context) {
        try {
            const { domain } = context.state;
            const items = await (0, typeorm_1.getRepository)(sales_base_1.ReleaseGood).query(`
       SELECT DISTINCT case when transporter = 'EMS' then 'EFMX' else transporter end from
        (SELECT DISTINCT UPPER(transporter) as transporter FROM release_goods WHERE domain_id = '${domain.id}' AND transporter IS NOT null AND transporter != '' AND type = 'b2c'
        UNION ALL
        SELECT DISTINCT UPPER(transporter) as transporter FROM order_packages WHERE domain_id = '${domain.id}' AND transporter IS NOT null AND transporter != '')foo`);
            return {
                items: items
            };
        }
        catch (error) {
            throw error;
        }
    }
};
//# sourceMappingURL=shipping-providers.js.map