// models/assets/assets.attributes.js // ─── Exclude sets ───────────────────────────────────────────────────────────── // Fields hidden from all roles (sensitive / internal storage details) const excludeAttributes = [ "checksum", // internal integrity hash, not useful to clients "storage_bucket", // internal storage config "storage_key", // internal Chibisafe / S3 key ]; // Admins see everything except the base excludes const adminExclude = [ ...excludeAttributes, ]; // Regular users also cannot see audit trails or soft-delete info const userExclude = [ ...excludeAttributes, "uploadedBy", "deletedAt", ]; // ─── No JSONB columns on assets ─────────────────────────────────────────────── // Assets has no JSONB columns so jsonbSchemas stays empty. const jsonbSchemas = {}; // ─── Computed attributes ────────────────────────────────────────────────────── // Add any SQL-computed fields here (e.g. a view count join). // Format: { key, label, type, order, literal } const computedAttributes = [ // Example: // { // key: "viewCount", // label: "Views", // type: "number", // order: 99, // literal: `(SELECT COUNT(*) FROM "asset_views" WHERE "asset_views"."asset_id" = "Asset"."asset_id")`, // }, ]; module.exports = { excludeAttributes, adminExclude, userExclude, jsonbSchemas, computedAttributes, };