ready to test

Testing

Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
This commit is contained in:
2026-06-22 10:06:58 +08:00
parent bf48c95467
commit 439bb33f77
189 changed files with 17559 additions and 686 deletions
@@ -0,0 +1,58 @@
// models/advertisements/advertisements.attributes.js
// ─── Exclude sets ─────────────────────────────────────────────────────────────
// Fields hidden from all roles (internal/denormalized details)
const excludeAttributes = [
"image_asset_id", // internal FK, "image" association exposes the resolved asset instead
];
// Admins see everything except the base excludes
const adminExclude = [
...excludeAttributes,
];
// Regular users also cannot see audit trails, soft-delete info, or click metrics
const userExclude = [
...excludeAttributes,
"click_count",
"createdBy",
"updatedBy",
"deletedBy",
"deletedAt",
];
// ─── JSONB schemas ──────────────────────────────────────────────────────────
// Describes shape of the `ctas` JSONB column for paginate's coercion/validation step.
const jsonbSchemas = {
ctas: {
type: "array",
itemShape: {
label: "string",
link: "string",
variant: "string", // "default" | "outline"
},
},
};
// ─── Computed attributes ──────────────────────────────────────────────────────
// Add any SQL-computed fields here (e.g. a "is_currently_live" derived flag).
// Format: { key, label, type, order, literal }
const computedAttributes = [
// Example:
// {
// key: "is_live",
// label: "Currently Live",
// type: "boolean",
// order: 99,
// literal: `("Advertisement"."is_active" = true AND "Advertisement"."start_date" <= NOW() AND ("Advertisement"."end_date" IS NULL OR "Advertisement"."end_date" >= NOW()))`,
// },
];
module.exports = {
excludeAttributes,
adminExclude,
userExclude,
jsonbSchemas,
computedAttributes,
};