"use strict";
/*
Get all projects signed in user collaborates on
that have at least one license applied to them.

See docs in @cocalc/server/licenses/get-projects.ts

Returns [Project1, Project2, ...] on success or {error:'a message'} on failure.
For the fields in the projects, see @cocalc/server/licenses/get-projects.ts
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const get_projects_1 = __importDefault(require("@cocalc/server/licenses/get-projects"));
const get_account_1 = __importDefault(require("lib/account/get-account"));
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) {
        return [];
    }
    return await (0, get_projects_1.default)(account_id);
}
//# sourceMappingURL=get-projects.js.map