UNPKG

@cocalc/database

Version:

CoCalc: code for working with our PostgreSQL database

30 lines 1.24 kB
"use strict"; /* * This file is part of CoCalc: Copyright © 2020 Sagemath, Inc. * License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details */ Object.defineProperty(exports, "__esModule", { value: true }); exports.pii_expire = exports.pii_retention_to_future = void 0; const misc_1 = require("@cocalc/util/misc"); const server_settings_1 = require("./server-settings"); // this converts what's in the pii_expired setting to a new Date in the future function pii_retention_to_future(pii_retention, data) { if (!pii_retention) return; const future = (0, misc_1.expire_time)(pii_retention); if (data != null) { data.expire = future; } return future; } exports.pii_retention_to_future = pii_retention_to_future; // use this to get the "expire" value for storing certain entries in the DB, // which contain personally identifiable information. // if data is set, it's expire field will be set. in any case, it returns the "Date" // in the future. async function pii_expire(db, data) { const settings = await (0, server_settings_1.get_server_settings)(db); return pii_retention_to_future(settings.pii_retention, data); } exports.pii_expire = pii_expire; //# sourceMappingURL=pii.js.map