Skip to content

PIX-93: change username in profileview#102

Merged
AndreaZavatta merged 2 commits into
developfrom
feature/PIX-93_change-username
Feb 2, 2026
Merged

PIX-93: change username in profileview#102
AndreaZavatta merged 2 commits into
developfrom
feature/PIX-93_change-username

Conversation

@AndreaZavatta
Copy link
Copy Markdown
Contributor

No description provided.

@AndreaZavatta AndreaZavatta requested a review from Copilot February 2, 2026 22:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements functionality to allow users to change their username from the profile view. The implementation adds a new API endpoint for updating usernames, with proper authentication and validation, and updates the frontend to provide an inline editing experience.

Changes:

  • Added backend API endpoint for updating user profiles with authentication and validation
  • Implemented frontend username editing UI with edit/save/cancel controls
  • Updated user store to persist username changes and refresh authentication token

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
server/src/services/user.service.ts Added updateUser method to handle username updates with validation and token regeneration
server/src/routes/api.ts Added PUT endpoint for user profile updates
server/src/controllers/user.controller.ts Added update controller with authorization and input validation
client/src/views/ProfileView.vue Added inline username editing UI with edit/save/cancel functionality
client/src/stores/user.store.ts Added updateProfile function to update username and persist changes
client/src/services/api.ts Added updateUser API function

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread client/src/stores/user.store.ts Outdated
localStorage.setItem("authToken", authToken)
localStorage.setItem("userId", userId)
localStorage.setItem("isAdmin", String(admin))
localStorage.setItem("isAdmin", String(admin))
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate localStorage.setItem call for 'isAdmin'. The second call on line 19 should be removed as it's redundant.

Suggested change
localStorage.setItem("isAdmin", String(admin))

Copilot uses AI. Check for mistakes.
Comment thread server/src/services/user.service.ts Outdated
throw new Error("User not found")
}

const token = jwt.sign({ id: user._id, username: user.username, isAdmin: user.isAdmin }, JWT_SECRET, { expiresIn: CONFIG.JWT.EXPIRES_IN as any })
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This JWT token generation logic is duplicated from the login method. Consider extracting it into a private helper method to improve maintainability and reduce code duplication.

Copilot uses AI. Check for mistakes.
Comment thread client/src/views/ProfileView.vue Outdated
const userStore = useUserStore();
const notificationStore = useInAppNotificationStore();
const { isMuted } = storeToRefs(notificationStore);
import { useToastStore } from '../stores/toast.store'; // Assuming toast store exists per api.ts file earlier
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment 'Assuming toast store exists per api.ts file earlier' is unclear and seems out of place. If the toast store is a standard part of the codebase, this comment should be removed or clarified.

Suggested change
import { useToastStore } from '../stores/toast.store'; // Assuming toast store exists per api.ts file earlier
import { useToastStore } from '../stores/toast.store';

Copilot uses AI. Check for mistakes.
Comment thread client/src/views/ProfileView.vue Outdated
Comment on lines +113 to +114
// Error is handled globally usually, but specific UI feedback here is good
console.error("Failed to update username", error);
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment suggests that error handling exists globally, but no toast error message is shown in the catch block. Either remove the comment or add appropriate user feedback for errors.

Suggested change
// Error is handled globally usually, but specific UI feedback here is good
console.error("Failed to update username", error);
console.error("Failed to update username", error);
toastStore.add('Failed to update username. Please try again.', 'error');

Copilot uses AI. Check for mistakes.
@AndreaZavatta AndreaZavatta merged commit ea976e4 into develop Feb 2, 2026
@AndreaZavatta AndreaZavatta deleted the feature/PIX-93_change-username branch February 2, 2026 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants