Implement birthdate input in member profile management. Update API to handle birthdate data for user profiles and enhance visibility settings for birthday display in member lists.
Some checks failed
Code Analysis (JS/Vue) / analyze (push) Failing after 1m4s
Some checks failed
Code Analysis (JS/Vue) / analyze (push) Failing after 1m4s
This commit is contained in:
@@ -57,7 +57,15 @@ export default defineEventHandler(async (event) => {
|
||||
const candidates = []
|
||||
|
||||
for (const m of manualMembers) {
|
||||
const isAccepted = m.active === true || (m.status && String(m.status).toLowerCase() === 'accepted') || m.accepted === true
|
||||
const normalizedStatus = m.status ? String(m.status).toLowerCase() : ''
|
||||
const hasExplicitAcceptanceFlag = m.active !== undefined || m.accepted !== undefined || normalizedStatus !== ''
|
||||
const isAccepted = hasExplicitAcceptanceFlag
|
||||
? (
|
||||
m.active === true ||
|
||||
m.accepted === true ||
|
||||
normalizedStatus === 'accepted'
|
||||
)
|
||||
: true
|
||||
if (!isAccepted) continue
|
||||
const vis = m.visibility || {}
|
||||
const showBirthday = vis.showBirthday === undefined ? true : Boolean(vis.showBirthday)
|
||||
|
||||
@@ -26,6 +26,7 @@ export default defineEventHandler(async (event) => {
|
||||
name: user.name,
|
||||
email: user.email,
|
||||
phone: user.phone || '',
|
||||
geburtsdatum: user.geburtsdatum || '',
|
||||
visibility: Object.assign({ showBirthday: true }, (user.visibility || {}))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ export default defineEventHandler(async (event) => {
|
||||
}
|
||||
|
||||
const body = await readBody(event)
|
||||
const { name, email, phone, currentPassword, newPassword } = body
|
||||
const { name, email, phone, geburtsdatum, currentPassword, newPassword } = body
|
||||
|
||||
if (!name || !email) {
|
||||
throw createError({
|
||||
@@ -58,6 +58,7 @@ export default defineEventHandler(async (event) => {
|
||||
user.name = name
|
||||
user.email = email
|
||||
user.phone = phone || ''
|
||||
user.geburtsdatum = geburtsdatum || ''
|
||||
|
||||
// Optional visibility preferences (what to show to other logged-in members)
|
||||
// Expected shape: { showEmail: boolean, showPhone: boolean, showAddress: boolean, showBirthday: boolean }
|
||||
@@ -105,6 +106,7 @@ export default defineEventHandler(async (event) => {
|
||||
email: user.email,
|
||||
name: user.name,
|
||||
phone: user.phone,
|
||||
geburtsdatum: user.geburtsdatum || '',
|
||||
visibility: user.visibility || {},
|
||||
roles: roles,
|
||||
role: roles[0] || 'mitglied' // Rückwärtskompatibilität
|
||||
|
||||
Reference in New Issue
Block a user