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

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


/* get up to limit projects that have the given user as a collaborator,
   ordered by how recently they were modified.

   DELETED and HIDDEN projects are skipped.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
const pool_1 = __importDefault(__webpack_require__(541808));
const misc_1 = __webpack_require__(854006);
// I may add more fields and more options later...
async function getProjects({ account_id, limit = 50, }) {
    if (!(0, misc_1.is_valid_uuid_string)(account_id)) {
        throw Error("account_id must be a UUIDv4");
    }
    if (limit <= 0) {
        return [];
    }
    const pool = (0, pool_1.default)();
    const { rows } = await pool.query(`SELECT project_id, title, description FROM projects WHERE DELETED IS NOT true AND users ? $1 AND (users#>>'{${account_id},hide}')::BOOLEAN IS NOT TRUE ORDER BY last_edited DESC LIMIT $2`, [account_id, limit]);
    return rows;
}
exports["default"] = getProjects;
//# sourceMappingURL=get.js.map

/***/ })

};
;