update
This commit is contained in:
@@ -544,6 +544,24 @@ class MemberService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures a mitglieder_profile row exists for the given user.
|
||||
* Safe to call on every login — idempotent via ON CONFLICT DO NOTHING.
|
||||
* Errors are caught and logged without throwing.
|
||||
*/
|
||||
async ensureProfileExists(userId: string): Promise<void> {
|
||||
try {
|
||||
await pool.query(
|
||||
`INSERT INTO mitglieder_profile (user_id, status)
|
||||
VALUES ($1, 'aktiv')
|
||||
ON CONFLICT (user_id) DO NOTHING`,
|
||||
[userId]
|
||||
);
|
||||
} catch (error) {
|
||||
logger.warn('ensureProfileExists failed (non-fatal)', { error, userId });
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns aggregate member counts, used by the dashboard KPI cards.
|
||||
* Optionally scoped to a single status value.
|
||||
|
||||
Reference in New Issue
Block a user