Implement Recipient List Import from CSV
gruz0 opened this issue · 0 comments
gruz0 commented
As a frontend developer, your task is to implement a feature that allows users to upload their recipients list from a CSV file on a specific group page. Users should be able to upload the CSV file from their computer using a popup dialog triggered by an "Import" button.
The following steps outline the expected behavior of the feature:
- On the specific group page, a button labeled "Import" should be prominently displayed.
- When a user clicks the "Import" button, a popup dialog should appear, prompting them to select a CSV file from their computer.
- Upon submitting the file selection in the popup dialog, the frontend should send the CSV file to the backend through a specific API endpoint (POST /api/groups/:group_id/import).
- The backend API will then parse the uploaded CSV file, validate its contents, and reject any invalid records.
- After successful validation, the backend will insert the valid recipients into the specified group.
- The user should receive a confirmation message indicating that the import has been successful.
Validations to be applied to the CSV file are as follows:
- Records with empty wallet addresses should be skipped during import.
- If the payment amount is invalid (not a number or a negative number), the frontend should insert a value of 0 for that particular recipient.
- If a recipient's display name is empty, the frontend should use the associated wallet address in its place.
- All values, including wallet addresses, contacts, and display names, should be cleansed of any leading or trailing whitespaces.
Good luck with the implementation! If you encounter any challenges during the development process, don't hesitate to reach out for assistance. We look forward to seeing the successful integration of this essential feature into our platform.