Updates
This commit is contained in:
parent
28040f44f4
commit
2394248d53
13 changed files with 571 additions and 538 deletions
|
|
@ -22,18 +22,6 @@ export default defineEventHandler(async (event) => {
|
|||
"notifications",
|
||||
];
|
||||
|
||||
// Privacy fields from validated body
|
||||
const privacyFields = [
|
||||
"pronounsPrivacy",
|
||||
"timeZonePrivacy",
|
||||
"avatarPrivacy",
|
||||
"studioPrivacy",
|
||||
"bioPrivacy",
|
||||
"locationPrivacy",
|
||||
"socialLinksPrivacy",
|
||||
"craftTagsPrivacy",
|
||||
];
|
||||
|
||||
// Build update object from validated data
|
||||
const updateData = {};
|
||||
|
||||
|
|
@ -53,14 +41,6 @@ export default defineEventHandler(async (event) => {
|
|||
updateData["board.slackHandle"] = body.boardSlackHandle;
|
||||
}
|
||||
|
||||
// Handle privacy settings
|
||||
privacyFields.forEach((privacyField) => {
|
||||
if (body[privacyField] !== undefined) {
|
||||
const baseField = privacyField.replace("Privacy", "");
|
||||
updateData[`privacy.${baseField}`] = body[privacyField];
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
const member = await Member.findByIdAndUpdate(
|
||||
memberId,
|
||||
|
|
@ -76,7 +56,7 @@ export default defineEventHandler(async (event) => {
|
|||
}
|
||||
|
||||
// Log which fields were updated
|
||||
const changedFields = Object.keys(body).filter(k => body[k] !== undefined && !k.endsWith('Privacy'))
|
||||
const changedFields = Object.keys(body).filter(k => body[k] !== undefined)
|
||||
if (changedFields.length) {
|
||||
logActivity(memberId, 'profile_updated', { fields: changedFields })
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue