fix: Update updateProfile service to handle timezone and full preferences including timeFormat
This commit is contained in:
@@ -374,10 +374,13 @@ export class AuthService {
|
||||
userId: string,
|
||||
updateData: {
|
||||
name?: string;
|
||||
timezone?: string;
|
||||
preferences?: {
|
||||
notifications?: boolean;
|
||||
emailUpdates?: boolean;
|
||||
darkMode?: boolean;
|
||||
measurementUnit?: 'metric' | 'imperial';
|
||||
timeFormat?: '12h' | '24h';
|
||||
};
|
||||
},
|
||||
): Promise<{ success: boolean; data: any }> {
|
||||
@@ -403,6 +406,12 @@ export class AuthService {
|
||||
this.logger.log(`Updated user.name to: "${user.name}"`);
|
||||
}
|
||||
|
||||
// Update timezone if provided
|
||||
if (updateData.timezone !== undefined) {
|
||||
user.timezone = updateData.timezone;
|
||||
this.logger.log(`Updated user.timezone to: "${user.timezone}"`);
|
||||
}
|
||||
|
||||
// Update preferences if provided
|
||||
if (updateData.preferences !== undefined) {
|
||||
user.preferences = updateData.preferences;
|
||||
@@ -411,7 +420,7 @@ export class AuthService {
|
||||
|
||||
const updatedUser = await this.userRepository.save(user);
|
||||
this.logger.log(
|
||||
`User saved. Updated name: "${updatedUser.name}", preferences:`,
|
||||
`User saved. Updated name: "${updatedUser.name}", timezone: "${updatedUser.timezone}", preferences:`,
|
||||
updatedUser.preferences,
|
||||
);
|
||||
|
||||
@@ -423,6 +432,7 @@ export class AuthService {
|
||||
name: updatedUser.name,
|
||||
role: 'user',
|
||||
locale: updatedUser.locale,
|
||||
timezone: updatedUser.timezone,
|
||||
emailVerified: updatedUser.emailVerified,
|
||||
preferences: updatedUser.preferences,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user