Fix: auth controller duplicate code - #868
Merged
Nitya-003 merged 2 commits intoJul 29, 2026
Merged
Conversation
…auction controller and related files The auctionController.js file was corrupted with duplicate imports (lines 111-118) and a duplicate createAuction function declaration causing SyntaxError. The same corruption pattern affected authController.js, batchController.js, Auction.js, Bid.js, and User.js - each had duplicate imports, duplicate schema/function definitions, and improperly closed blocks. This fix removes all duplicated code blocks, properly closes all functions, and fixes Decimal128 handling in authController's addFunds function.
|
@Kirtan-pc is attempting to deploy a commit to the Nitya Gosain's projects Team on Vercel. A member of the Team first needs to authorize it. |
Nitya-003
approved these changes
Jul 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📌 Overview
This PR fixes the badly merged
backend/controllers/authController.jswhich had fully duplicated imports (lines 1-14 and 15-27), duplicate schema definitions producing unreachable dead code (lines 88-112), a duplicatesanitizeUserhelper (lines 152-158 vs 159-165) where the second version returned rawuser.balanceinstead oftoNumber(user.balance || 0), and a duplicateresetPasswordfunction (lines 880-928 vs 929-1019) where the second version used a weakerpassword.length < 8string-length check instead of the proper ZodpasswordSchema.🛠️ Type of Change
🔗 Related Issue
Closes #829
🧪 Testing & Verification
npx hardhat testpassed? (Yes/No/NA)authController.jsloads without syntax errors and uses Zod validation consistently📸 Screenshots / Demos
N/A
✅ PR Checklist
💬 Additional Notes
The corruption was introduced by a merge that duplicated every code block in the file. The second
resetPasswordsilently overrode the first, usingpassword.length < 8instead of the Zod schema with full character-class requirements (uppercase, lowercase, digit, special char). Similarly, the secondsanitizeUseroverrode the first and returned rawNumberbalance instead of thetoNumber()-converted value. All duplicate blocks have been removed and the single remaining implementations use consistent validation and Decimal128 handling.