Implement user search and bulk user import via CSV#453
Merged
Conversation
|
@gabito1451 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
The user search functionality is now fully integrated, type-safe, and verified within the build environment. closes #308
also, I have implemented the bulk user import functionality via CSV.
Key Features Implemented:
CSV Parsing and Validation:
Integrated csv-parse for robust CSV handling.
Validated required fields: email, firstName, lastName, and password.
Ensured email format correctness and password minimum length.
Detected duplicate emails within the CSV and against the existing database.
Secure Bulk Creation:
Passwords are automatically hashed using bcrypt during import.
Unique referral codes are generated for every imported user.
Created users are processed within a database transaction to ensure atomicity.
Automatically initializes passwordHistory for all imported users.
Import Reporting:
Returns a detailed report after processing.
Includes total records, success count, failure count, and a list of specific errors with row numbers for easy debugging.
Admin Endpoint:
Added POST /api/users/import/csv.
Secured with JwtAuthGuard and RolesGuard, accessible only by ADMIN users.
Uses Multer for secure file upload handling.
closes #317