fix: apply prettier formatting to userService.js

- Fixed all prettier formatting issues in userService.js
- All files now pass prettier format check
- Maintained null checks and error handling improvements
This commit is contained in:
gorkem-bwl committed 2025-09-11 23:55:58 -04:00
1 parent 25d538504c
commit 05442af050
1 file changed
+5 -5
+5 -5
View File
@@ -85,12 +85,12 @@ class UserService {
// Check if user exists // Check if user exists
try { try {
const user = await this.db.userModule.getUserByEmail(email); const user = await this.db.userModule.getUserByEmail(email);
// Add null check before password comparison // Add null check before password comparison
if (!user || !user.comparePassword) { if (!user || !user.comparePassword) {
throw this.errorService.createAuthenticationError(this.stringService.authIncorrectPassword); throw this.errorService.createAuthenticationError(this.stringService.authIncorrectPassword);
} }
// Compare password // Compare password
const match = await user.comparePassword(password); const match = await user.comparePassword(password);
if (match !== true) { if (match !== true) {
@@ -117,7 +117,7 @@ class UserService {
error: error.message, error: error.message,
stack: error.stack, stack: error.stack,
}); });
// If user is not found, throw a generic authentication error for security // If user is not found, throw a generic authentication error for security
// Don't reveal whether user exists or password is wrong // Don't reveal whether user exists or password is wrong
throw this.errorService.createAuthenticationError(this.stringService.authIncorrectPassword); throw this.errorService.createAuthenticationError(this.stringService.authIncorrectPassword);
@@ -132,12 +132,12 @@ class UserService {
updates.email = currentUser.email; updates.email = currentUser.email;
// Get user // Get user
const user = await this.db.userModule.getUserByEmail(currentUser.email); const user = await this.db.userModule.getUserByEmail(currentUser.email);
// Add null check before password comparison // Add null check before password comparison
if (!user || !user.comparePassword) { if (!user || !user.comparePassword) {
throw this.errorService.createAuthorizationError(this.stringService.authIncorrectPassword); throw this.errorService.createAuthorizationError(this.stringService.authIncorrectPassword);
} }
// Compare passwords // Compare passwords
const match = await user.comparePassword(updates?.password); const match = await user.comparePassword(updates?.password);
// If not a match, throw a 403 // If not a match, throw a 403