aboutsummaryrefslogtreecommitdiffstats
path: root/Dockerfile
diff options
context:
space:
mode:
Diffstat (limited to 'Dockerfile')
0 files changed, 0 insertions, 0 deletions
a id='n46' href='#n46'>46
export const addUserSearch = function(input, table) {
  var { search, starts_with, contains } = input;

  if (!table) {
    table = "users";
  }
  // if (since) cmd = cmd.havingRaw('invoices + payments + deposits + orders > ?', [0])

  if (search) {
    if (starts_with) {
      search = search + "%";
    } else if (contains) {
      search = "%" + search + "%";
    }

    var condition =
      "(" +
      table +
      ".email like '" +
      search +
      "' OR " +
      table +
      ".username like '" +
      search +
      "')";

    return condition;
  } else {
    return "";
  }
};

export const addTimeSearch = function(input, field) {
  if (!field) {
    field = "updatedAt";
  }

  var { since } = input;
  if (since) {
    condition = field + " >= '" + since + "'";

    return condition;
  } else {
    return "";
  }
};