Skip to content

Conversation

@codeunia-dev
Copy link
Owner

@codeunia-dev codeunia-dev commented Nov 12, 2025

  • Implement new event management pages for creating, editing, and listing events
  • Add API route for checking company member invitation status
  • Enhance forgot password page with improved error handling and user feedback
  • Update invitation acceptance flow to use new check-invitation endpoint
  • Improve error handling and user experience across multiple components
  • Add support for more granular error messages in authentication flows

Summary by CodeRabbit

  • New Features

    • Added event creation and editing interfaces for managing company events.
    • Introduced event dashboard with search filtering, statistics cards, and real-time event management.
    • Added invitation verification system with improved error handling.
  • Bug Fixes

    • Improved error messages for password reset with specific feedback on common failures.
  • Performance

    • Optimized event page rendering with memoized parameters.

- Implement new event management pages for creating, editing, and listing events
- Add API route for checking company member invitation status
- Enhance forgot password page with improved error handling and user feedback
- Update invitation acceptance flow to use new check-invitation endpoint
- Improve error handling and user experience across multiple components
- Add support for more granular error messages in authentication flows
@vercel
Copy link

vercel bot commented Nov 12, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
codeunia Building Building Preview Comment Nov 12, 2025 10:55am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 12, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This PR introduces company event management functionality with new API routes for membership verification, dedicated dashboard pages for creating and editing events, an events listing page with filtering capabilities, and updates to the events service layer to manage event creation and editing workflows.

Changes

Cohort / File(s) Summary
New Membership Verification API
app/api/companies/[slug]/members/check-invitation/route.ts
Adds GET endpoint to check if authenticated user is invited to a company; authenticates user, resolves company by slug, queries membership status, and returns membership data or null with appropriate error responses (401 for unauthorized, 404 for missing company, 200 for success/no membership).
Authentication Error Handling
app/auth/forgot-password/page.tsx
Replaces generic error throwing with client-side error handling; logs errors and shows context-specific toast messages for email/SMTP misconfiguration and rate limiting scenarios with fallback for other errors.
Company Invitation Acceptance
app/dashboard/company/[slug]/accept-invitation/page.tsx
Updates to call new check-invitation API endpoint instead of /members endpoint; extracts membership data directly from response and improved error handling with server response messages.
Event Management Pages
app/dashboard/company/[slug]/events/page.tsx, app/dashboard/company/[slug]/events/create/page.tsx, app/dashboard/company/[slug]/events/[eventSlug]/edit/page.tsx
Introduces events dashboard with search/filter and statistics; creates new page for event creation with form; creates new page for event editing with delete confirmation, displaying event details, status/approval badges, and action controls.
Events Service Layer
lib/services/events.ts
Modifies createEvent to extract payment from price data and set approval_status to pending; prevents status updates in updateEvent by excluding it from payload transformation.
Events Display and Hook Refactoring
app/events/page.tsx
Refactors useEvents hook invocation to accept memoized parameters object; comments out useFeaturedEvents and adds debug logging for loading states and data inspection.

Sequence Diagrams

sequenceDiagram
    participant User
    participant CheckInvite as Check Invitation API
    participant DB as Database
    participant Accept as Accept Invitation Page

    User->>Accept: Navigate to accept invitation
    Accept->>CheckInvite: GET /api/companies/[slug]/members/check-invitation
    CheckInvite->>CheckInvite: Verify auth & resolve company
    CheckInvite->>DB: Query company_members
    alt Membership Exists
        DB-->>CheckInvite: membership record
        CheckInvite-->>Accept: 200 {success, membership}
        Accept->>User: Display membership info
    else No Membership
        DB-->>CheckInvite: no record (PGRST116)
        CheckInvite-->>Accept: 200 {success, membership: null}
        Accept->>User: Show not invited message
    else Company Not Found
        CheckInvite-->>Accept: 404
        Accept->>User: Show error
    end
Loading
sequenceDiagram
    participant User
    participant EventsPage as Events Dashboard
    participant API as Events API
    participant EditPage as Event Edit Page

    User->>EventsPage: Load dashboard
    EventsPage->>API: Fetch events (status=all, limit=100)
    API-->>EventsPage: events list
    EventsPage->>EventsPage: Compute stats, filter by search
    EventsPage->>User: Display table with statistics

    User->>EventsPage: Click edit action
    EventsPage->>EditPage: Navigate with eventSlug
    EditPage->>API: Fetch /api/events/{slug}
    API-->>EditPage: event data
    EditPage->>User: Display form in edit mode

    User->>EditPage: Submit changes
    EditPage->>API: Update event
    API-->>EditPage: success
    EditPage->>User: Toast success, redirect
Loading
sequenceDiagram
    participant User
    participant CreatePage as Create Event Page
    participant EventForm as Event Form
    participant Service as Events Service
    participant API as Events API

    User->>CreatePage: Navigate to create
    CreatePage->>User: Display form in create mode

    User->>EventForm: Fill form & submit
    EventForm->>Service: createEvent(eventData)
    Service->>Service: Extract payment from price
    Service->>Service: Set approval_status=pending
    Service->>API: Insert event record
    API-->>Service: success with event ID
    Service-->>EventForm: success callback
    EventForm->>User: Toast success, navigate to events
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • New API route logic: Verify authentication flow, error handling branches, and database query correctness in check-invitation endpoint
  • Multiple new page components: Review state management, data fetching, loading/error states, and UI logic across three event-related pages; verify consistency in patterns and error handling
  • Service layer modifications: Confirm payment extraction logic, approval_status defaults, and verify that status is properly excluded from updates in both create and update paths
  • Integration points: Verify that the new check-invitation API is correctly consumed in accept-invitation page and that event pages properly call updated service methods
  • Hook refactoring: Review memoization strategy and dependency array correctness for performance implications

Poem

🐰 New routes and pages bloom so bright,
Events dance in dashboard light—
Check invitations, create with flair,
Edit, delete without a care!
Status pending, stats on display,
Rabbit hops through code today! 🥕

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/multicompanylevel

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2544805 and 943ce60.

📒 Files selected for processing (8)
  • app/api/companies/[slug]/members/check-invitation/route.ts (1 hunks)
  • app/auth/forgot-password/page.tsx (1 hunks)
  • app/dashboard/company/[slug]/accept-invitation/page.tsx (1 hunks)
  • app/dashboard/company/[slug]/events/[eventSlug]/edit/page.tsx (1 hunks)
  • app/dashboard/company/[slug]/events/create/page.tsx (1 hunks)
  • app/dashboard/company/[slug]/events/page.tsx (1 hunks)
  • app/events/page.tsx (6 hunks)
  • lib/services/events.ts (2 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

3 participants