Skip to content

Conversation

@BenNotix
Copy link

Description

This PR introduces a new feature allowing group owners to import participants into a group via CSV upload. It includes the full frontend and backend implementation for parsing and validating participant data, previewing entries before import, handling errors, and updating the database.

Internationalization has been added for all related UI and error messages (EN, ES, PT).

Additionally, this PR adds Docker to support development and deployment workflows, and applies a small fix to the lottery endpoint.

Related Issue

Closes #5

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring
  • Performance improvement
  • Dependency update
  • Other (please describe):

Changes Made

Participant Import Feature

  • Added ParticipantsImportCard component enabling CSV upload, participant preview, validation, error handling, and import flow.
    Files:

    • app/[locale]/group/[groupId]/dashboard/ParticipantsImportCard.tsx
    • Integration into GroupDashboard.tsx.
  • Added new backend endpoint:
    POST /api/group/import-participants
    Features:

    • Validates CSV data
    • Prevents duplicate participants
    • Only group owners may import
    • Disabled after lottery is drawn

Internationalization

  • Added EN / ES / PT translations for all import-related strings.
    Files updated:
    • messages/en.json
    • messages/es.json
    • messages/pt.json

DevOps / Docker

  • Added .dockerignore to reduce build context size.
  • Introduced multi-stage Dockerfile for efficient Next.js builds and production runtime.

Minor Fixes

  • Adjusted rate-limiting order in the lottery API to ensure request body is parsed only once.
    File:
    • app/api/lottery/run/route.ts

Screenshots

CleanShot 2025-12-11 at 16 55 02

Testing

The feature has been manually validated in a real group context, ensuring CSV files are correctly parsed, validated, previewed, and imported, and that permissions and error states behave as expected.

Test Environment

  • OS: macOS / Linux
  • Browser: Chrome & Firefox
  • Node.js version: 20+

Test Steps

  1. Create a group as an owner.
  2. Open the dashboard and upload a CSV file.
  3. Verify parsed participant preview, error handling, and duplicate detection.
  4. Import participants and confirm database update + UI refresh.
  5. Attempt import after lottery is drawn → verify it is blocked.
  6. Validate translations appear correctly across locales.

Test Results

  • All existing tests pass
  • New tests added (if applicable)
  • Manual testing completed

Checklist

Code Quality

  • My code follows the project's code style guidelines
  • I have run npm run check and all checks pass
  • I have run npm run build and the build succeeds
  • My code has no TypeScript errors
  • I have removed all console.log statements (except intentional logging)
  • I have removed all TODO/FIXME comments (or documented why they remain)

Documentation

  • I have updated the documentation accordingly
  • I have added/updated comments for complex logic
  • I have updated the README if needed

Security

  • My changes don't introduce security vulnerabilities
  • I have not committed any secrets or sensitive data
  • I have tested my changes with CSRF protection enabled (if applicable)
  • Input validation is implemented where needed

Dependencies

  • I have not added unnecessary dependencies
  • New dependencies are from trusted sources
  • I have run npm audit and addressed any issues

Breaking Changes

None

Additional Notes

  • CSV parsing is intentionally lightweight and designed for user-friendly feedback.
  • Error states include invalid format, invalid emails, duplicate entries, and forbidden access when the lottery is already drawn.
  • Docker improvements make local development and production deployment more predictable.

Reviewer Checklist

  • Code quality and style
  • Functionality works as described
  • Tests are adequate
  • Documentation is clear
  • No security concerns
  • No performance concerns

@vercel
Copy link

vercel bot commented Dec 11, 2025

@BenNotix is attempting to deploy a commit to the smarchi's projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

[BUG] "Body is unusable: Body has already been read"

1 participant