"use strict";
/* Return information about a given license. */
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"));
const check_disk_name_uniqueness_1 = require("@cocalc/util/licenses/check-disk-name-uniqueness");
const get_account_1 = __importDefault(require("lib/account/get-account"));
const get_params_1 = __importDefault(require("lib/api/get-params"));
async function handle(req, res) {
    try {
        res.json(await get(req));
    }
    catch (err) {
        res.json({ error: err.message });
        return;
    }
}
exports.default = handle;
async function get(req) {
    const account_id = await (0, get_account_1.default)(req);
    if (account_id == null)
        throw new Error(`user not logged in`);
    return await (0, check_disk_name_uniqueness_1.checkDedicateDiskNameUniqueness)((0, pool_1.default)(), (0, get_params_1.default)(req).name);
}
//# sourceMappingURL=check-disk-name.js.map