mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
chore: relocate backend into apps/api ahead of monorepo merge
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
const excludeAttributes = [
|
||||
"password", "otp_code", "otp_expires_at", 'must_change_password', 'password_expires_at', "needs_intro",
|
||||
"personal_info.name.given_name",
|
||||
"personal_info.name.middle_name",
|
||||
"personal_info.name.last_name",
|
||||
"personal_info.name.extension_name",
|
||||
"personal_info.addresses[]",
|
||||
"personal_info.addresses[].city",
|
||||
"personal_info.addresses[].country",
|
||||
"personal_info.addresses[].street",
|
||||
"personal_info.addresses[].zip",
|
||||
"personal_info.addresses[].address_type",
|
||||
"personal_info.addresses[].state",
|
||||
"personal_info.phone_number[]",
|
||||
"personal_info.phone_number[].country_code",
|
||||
"personal_info.phone_number[].number",
|
||||
"personal_info.phone_number[].phone_type",
|
||||
];
|
||||
|
||||
const jsonbSchemas = {
|
||||
personal_info: {
|
||||
name: {
|
||||
full_name: { type: "text", label: "Full Name", order: 2 }, // ← slot 2
|
||||
},
|
||||
date_of_birth: { type: "date", label: "Date of Birth", order: 4 },
|
||||
occupation: { type: "text", label: "Occupation", order: 5 },
|
||||
// addresses: {
|
||||
// full_address: { type: "text", label: "Full Address" },
|
||||
// },
|
||||
// phone_number: {
|
||||
// full_number: { type: "text", label: "Phone Number" },
|
||||
// },
|
||||
},
|
||||
};
|
||||
|
||||
// Different exclude sets per role
|
||||
const adminExclude = [
|
||||
...excludeAttributes,
|
||||
// admins can see audit fields, so nothing extra excluded
|
||||
];
|
||||
|
||||
const userExclude = [
|
||||
...excludeAttributes,
|
||||
// regular users cannot see audit trails
|
||||
"created_by", "updated_by", "deleted_by",
|
||||
"deleted_at",
|
||||
];
|
||||
|
||||
const computedAttributes = [
|
||||
{
|
||||
key: "groups",
|
||||
label: "Groups",
|
||||
type: "array", // tells the paginator this is a pre-joined association array
|
||||
order: 5,
|
||||
filterable: true, // handled specially in the controller — see extractGroupsFilter()
|
||||
},
|
||||
];
|
||||
|
||||
module.exports = { excludeAttributes, adminExclude, userExclude, jsonbSchemas, computedAttributes };
|
||||
Reference in New Issue
Block a user