feat: Track storage usage

This commit is contained in:
Maksim Eltyshev
2025-08-23 00:03:20 +02:00
parent 2f4bcb0583
commit 4d77a1f596
89 changed files with 1052 additions and 304 deletions

View File

@@ -0,0 +1,36 @@
/*!
* Copyright (c) 2024 PLANKA Software GmbH
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
*/
const makeWhereQueryBuilder = (Model) => (criteria) => {
if (_.isPlainObject(criteria)) {
if (Object.keys(criteria).length === 0) {
throw new Error('Empty criteria');
}
const parts = [];
const values = [];
// eslint-disable-next-line no-restricted-syntax
for (const [key, value] of Object.entries(criteria)) {
// eslint-disable-next-line no-underscore-dangle
const columnName = Model._transformer._transformations[key];
if (!columnName) {
throw new Error('Unknown column');
}
parts.push(`${columnName} = $${index + 1}`);
values.push(value);
}
return [parts.join(' AND '), values];
}
return ['id = $1', [criteria]];
};
module.exports = {
makeWhereQueryBuilder,
};