Skip to content

Conversation

@codeunia-dev
Copy link
Owner

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

This PR introduces the company resubmission flow, enabling company owners to update their details and re-submit their registration after it has been rejected.


🔄 Key Features Added

Resubmission Flow

  • Owners can now edit previously rejected company details.
  • Re-submit action triggers a fresh review cycle.
  • Status automatically resets from rejected → pending_review.

📝 UI/UX Enhancements

  • Updated forms and components to reflect resubmission state.
  • Clear messaging for rejected companies guiding owners to update and resubmit.

🔐 Permission Controls

  • Only company owners are allowed to perform resubmission.
  • Reviewers/admins continue to follow the standard approval workflow.

🧰 Backend Updates

  • Added API method to handle company resubmission.
  • Validation ensures only rejected companies can be resubmitted.
  • Audit log entry added to track resubmission attempts.

🎯 Why This Matters

This feature ensures companies that were rejected due to incomplete or incorrect information don't need to re-register entirely. It improves:

  • User experience
  • Reviewer workflow
  • Data consistency
  • Operational efficiency

Authored by: @akshay0611

Summary by CodeRabbit

  • New Features
    • Rejected companies can now easily resubmit their applications with all previously entered information automatically pre-filled in the form
    • Access detailed rejection feedback and verification notes to understand exactly what corrections are required
    • Streamlined resubmission workflow enables faster updates and successful reapplication without re-entering company data

✏️ Tip: You can customize this high-level summary in your review settings.

…and re-submit rejected company registrations.
@vercel
Copy link

vercel bot commented Nov 21, 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 21, 2025 6:41am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 21, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Introduces a resubmission flow allowing rejected companies to update their registration data and resubmit. This includes a new GET endpoint to fetch rejected company details, updates to the registration POST endpoint to handle both new and update paths, UI changes to support pre-population and resubmission feedback, and form modifications to track company ownership during creation.

Changes

Cohort / File(s) Summary
API Routes
app/api/companies/register/route.ts, app/api/companies/resubmit/[id]/route.ts
POST route extended to accept optional companyId for updates; validates ownership and rejected status before updating company details, clears verification notes, and resets status to pending. New GET route fetches rejected company data with structured address/socials objects, performs ownership and status validation, and returns pre-filled payload for form.
Registration Page
app/companies/register/page.tsx
Wraps registration in Suspense; introduces CompanyRegisterContent component to manage resubmission flow, including fetching via /api/companies/resubmit/[id], handling loading/error states, and conditionally rendering UI for initial registration vs. resubmission with verification feedback banner.
Form Component
components/companies/CompanyRegistrationForm.tsx
Extended with initialData and companyId props to support prefill and update scenarios; form submission includes companyId when updating; success messages differentiate between new registration and update.
Service Layer
lib/services/company-service.ts
Adds owner_id: userId to company data during creation to track ownership for verification purposes.

Sequence Diagram

sequenceDiagram
    participant User
    participant UI as Register Page
    participant GetAPI as GET /resubmit/[id]
    participant DB as Database
    participant Form as Registration Form
    participant PostAPI as POST /register

    Note over User,PostAPI: Resubmission Flow

    User->>UI: Navigate with resubmit ID
    UI->>GetAPI: Fetch company data
    GetAPI->>DB: Query company by ID
    DB-->>GetAPI: Return company (rejected status)
    GetAPI->>GetAPI: Validate: ownership & rejected status
    GetAPI-->>UI: Return structured payload (address, socials)
    UI->>UI: Show verification feedback banner
    UI->>Form: Pass initialData & companyId

    User->>Form: Update and submit
    Form->>Form: Build FormData with companyId
    Form->>PostAPI: POST with companyId
    PostAPI->>DB: Check company exists & owned
    DB-->>PostAPI: Confirm rejected status
    PostAPI->>DB: Update company, reset status to pending
    PostAPI-->>Form: Success response
    Form->>UI: Trigger success toast (Update)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • API validation logic: Review error handling and ownership/status checks in both routes; ensure no security bypasses in the resubmission flow.
  • State management in page component: Verify loading/error handling during data fetch and toast notifications.
  • Form prop changes: Confirm initialData/companyId props are correctly threaded and that submission distinguishes between new and update paths.
  • Service layer update: Ensure owner_id is consistently tracked and does not break existing company creation flows.

Poem

🐰 A rejected form hops back in the door,
With data pre-filled, now polished once more,
The ownership tracked, the status set right,
A second chance blooms—resubmission takes flight! ✨

✨ 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/companyregisterationflow

📜 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 2f8c1e8 and 31f8497.

📒 Files selected for processing (5)
  • app/api/companies/register/route.ts (1 hunks)
  • app/api/companies/resubmit/[id]/route.ts (1 hunks)
  • app/companies/register/page.tsx (6 hunks)
  • components/companies/CompanyRegistrationForm.tsx (10 hunks)
  • lib/services/company-service.ts (1 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.

@codeunia-dev codeunia-dev merged commit bbb0e24 into main Nov 21, 2025
2 of 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.

3 participants