Skip to content

Implement user search and bulk user import via CSV#453

Merged
LaGodxy merged 1 commit into
MettaChain:mainfrom
gabito1451:Add-user-search
Apr 23, 2026
Merged

Implement user search and bulk user import via CSV#453
LaGodxy merged 1 commit into
MettaChain:mainfrom
gabito1451:Add-user-search

Conversation

@gabito1451
Copy link
Copy Markdown
Contributor

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

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Apr 23, 2026

@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! 🚀

Learn more about application limits

Copy link
Copy Markdown
Contributor

@LaGodxy LaGodxy left a comment

Choose a reason for hiding this comment

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

LGTM,

@LaGodxy LaGodxy merged commit 0dced66 into MettaChain:main Apr 23, 2026
4 checks passed
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.

Implement Bulk User Import Add User Search

2 participants