Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
This commit is contained in:
2026-07-12 12:39:17 +08:00
parent 82ea9c77c4
commit ea3e82e54c
47 changed files with 1301 additions and 481 deletions
+12
View File
@@ -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(