ref: Little refactoring

This commit is contained in:
Maksim Eltyshev
2025-08-30 17:09:17 +02:00
parent 60a94f33fc
commit 4c5c7799f2
42 changed files with 89 additions and 19 deletions

View File

@@ -3,9 +3,9 @@
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
*/
const LIMIT = 50;
const buildSearchParts = require('../../../../utils/build-query-parts');
const SEARCH_PARTS_REGEX = /[ ,;]+/;
const LIMIT = 50;
const defaultFind = (criteria, { sort = 'id', limit } = {}) =>
Card.find(criteria).sort(sort).limit(limit);
@@ -53,13 +53,7 @@ const getIdsByEndlessListId = async (
queryValues.push(search.substring(1));
query += ` AND (card.name ~* $${queryValues.length} OR card.description ~* $${queryValues.length})`;
} else {
const searchParts = search.split(SEARCH_PARTS_REGEX).flatMap((searchPart) => {
if (!searchPart) {
return [];
}
return searchPart.toLowerCase();
});
const searchParts = buildSearchParts(search);
if (searchParts.length > 0) {
let ilikeValues = searchParts.map((searchPart) => {