mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
@@ -7,6 +7,13 @@ const ENUM_SORT_ORDER = {
|
||||
reg_type: ["system", "google"],
|
||||
};
|
||||
|
||||
// createdBy/updatedBy/deletedBy filter options come from getFieldValues()
|
||||
// as { value: user_id, label: full_name } — the filter sheet selects by id,
|
||||
// so these need an exact match against the bigint column, never the
|
||||
// substring-on-text-cast path used for everything else (that path compares
|
||||
// against the raw id and can never match a name-looking value).
|
||||
const AUDIT_ID_FIELDS = new Set(["createdBy", "updatedBy", "deletedBy"]);
|
||||
|
||||
/**
|
||||
* Builds a Sequelize `where` clause from an array of filters.
|
||||
*
|
||||
@@ -22,6 +29,11 @@ function buildWhere(filters = [], allowedFields = new Set()) {
|
||||
|
||||
const values = Array.isArray(value) ? value : [value];
|
||||
|
||||
if (AUDIT_ID_FIELDS.has(id)) {
|
||||
where.push({ [id]: { [Op.in]: values } });
|
||||
continue;
|
||||
}
|
||||
|
||||
const conditions = values.map((v) =>
|
||||
id.startsWith("personal_info.")
|
||||
? Sequelize.where(
|
||||
|
||||
Reference in New Issue
Block a user