refactor: refs #7457 Added from param if not exists #2502

Merged
jgallego merged 14 commits from 7457-orderFilter into dev 2024-11-19 05:33:35 +00:00
1 changed files with 11 additions and 2 deletions
Showing only changes of commit 33f1ed360b - Show all commits

View File

@ -96,9 +96,18 @@ module.exports = Self => {
teamMembersId.push(userId); teamMembersId.push(userId);
} }
if (args && args.myTeam) if (args?.myTeam)
args.teamIds = teamIds; args.teamIds = teamIds;
if (args?.to)
args.to.setHours(23, 59, 0, 0);
if (!args.from) {
const yesterday = new Date();
yesterday.setDate(yesterday.getDate() - 1);
args.from = yesterday.toISOString().split('T')[0];
}
const where = buildFilter(args, (param, value) => { const where = buildFilter(args, (param, value) => {
switch (param) { switch (param) {
case 'search': case 'search':
@ -194,7 +203,7 @@ module.exports = Self => {
`); `);
stmt.merge(conn.makeWhere(filter.where)); stmt.merge(conn.makeWhere(filter.where));
stmt.merge(`GROUP BY id`); stmt.merge(`GROUP BY o.id`);
stmt.merge(conn.makePagination(filter)); stmt.merge(conn.makePagination(filter));
stmts.push(stmt); stmts.push(stmt);
stmts.push(`SET SESSION optimizer_search_depth = @_optimizer_search_depth`); stmts.push(`SET SESSION optimizer_search_depth = @_optimizer_search_depth`);