"use strict";
exports.id = 4757;
exports.ids = [4757];
exports.modules = {

/***/ 494757:
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {


/*
Get shopping cart items.  By default gets the current shopping cart,
but you can also get all items that have been removed from the cart,
and also all items that were purchased.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getItem = void 0;
const misc_1 = __webpack_require__(854006);
const pool_1 = __importDefault(__webpack_require__(541808));
async function getCart({ account_id, purchased, removed, }) {
    (0, misc_1.assertValidAccountID)(account_id);
    const pool = (0, pool_1.default)();
    const { rows } = await pool.query(`SELECT * FROM shopping_cart_items WHERE account_id=$1 AND purchased IS ${purchased ? " NOT " : ""} NULL AND removed IS ${removed ? " NOT " : ""} NULL ORDER BY id DESC`, [account_id]);
    return rows;
}
exports["default"] = getCart;
async function getItem({ account_id, id, }) {
    (0, misc_1.assertValidAccountID)(account_id);
    const pool = (0, pool_1.default)();
    const { rows } = await pool.query("SELECT * FROM shopping_cart_items WHERE account_id=$1 AND id=$2", [account_id, id]);
    if (rows.length == 0) {
        throw Error(`no item with id ${id}`);
    }
    return rows[0];
}
exports.getItem = getItem;
//# sourceMappingURL=get.js.map

/***/ })

};
;