UNPKG

@cocalc/database

Version:

CoCalc: code for working with our PostgreSQL database

18 lines 768 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const pool_1 = __importDefault(require("@cocalc/database/pool")); // raises an exception if no such account. async function getAccountId({ email_address, }) { const pool = (0, pool_1.default)("medium"); const { rows } = await pool.query("SELECT account_id FROM accounts WHERE email_address=$1", [email_address]); if (rows.length == 0) { throw Error(`no account with email address '${email_address}'`); } const { account_id } = rows[0]; return account_id; } exports.default = getAccountId; //# sourceMappingURL=get.js.map