registration errors in progress
All checks were successful
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Successful in 6m16s

This commit is contained in:
2025-12-10 08:41:30 -08:00
parent 7912d29961
commit 8da5a2118e
3 changed files with 109 additions and 45 deletions

View File

@@ -86,8 +86,27 @@ export class UserRepository {
JOIN public.profiles p ON u.user_id = p.user_id
WHERE u.user_id = $1;
`;
const finalProfileRes = await client.query<UserProfile>(profileQuery, [newUserId]);
const fullUserProfile = finalProfileRes.rows[0];
const finalProfileRes = await client.query(profileQuery, [newUserId]);
const flatProfile = finalProfileRes.rows[0];
if (!flatProfile) {
throw new Error('Failed to create or retrieve user profile after registration.');
}
// Construct the nested UserProfile object to match the type definition.
const fullUserProfile: UserProfile = {
user: {
user_id: flatProfile.user_id,
email: flatProfile.email,
},
user_id: flatProfile.user_id,
full_name: flatProfile.full_name,
avatar_url: flatProfile.avatar_url,
role: flatProfile.role,
points: flatProfile.points,
preferences: flatProfile.preferences,
};
logger.debug(`[DB createUser] Fetched full profile for new user:`, { user: fullUserProfile });
await client.query('COMMIT');