Skip to content

Conversation

@codeunia-dev
Copy link
Owner

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

  • Add hackathon creation and editing pages in company dashboard
  • Implement hackathon moderation queue in admin panel with approval/rejection workflow
  • Create HackathonForm component for creating and editing hackathons
  • Add API endpoints for hackathon CRUD operations and moderation actions
  • Implement hackathon submission workflow with status tracking
  • Add tabbed interface to moderation page for managing both events and hackathons
  • Enhance hackathon service with submission and moderation logic
  • Update company hackathons listing page with management capabilities
  • Add hackathon statistics tracking in moderation dashboard

Authored by: @akshay0611

Summary by CodeRabbit

  • New Features

    • Added tabbed moderation interface for managing events and hackathons separately
    • Introduced hackathon management dashboard for companies with create, edit, and delete capabilities
    • Implemented hackathon submission workflow for approval by administrators
    • Added admin moderation queue for reviewing and acting on pending hackathons
  • Improvements

    • Enhanced authorization and authentication checks across hackathon endpoints
    • Implemented membership verification for company-specific access control

…on system

- Add hackathon creation and editing pages in company dashboard
- Implement hackathon moderation queue in admin panel with approval/rejection workflow
- Create HackathonForm component for creating and editing hackathons
- Add API endpoints for hackathon CRUD operations and moderation actions
- Implement hackathon submission workflow with status tracking
- Add tabbed interface to moderation page for managing both events and hackathons
- Enhance hackathon service with submission and moderation logic
- Update company hackathons listing page with management capabilities
- Add hackathon statistics tracking in moderation dashboard
@vercel
Copy link

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

@codeunia-dev codeunia-dev merged commit 8c97738 into main Nov 15, 2025
1 of 4 checks passed
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 15, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Added hackathon moderation infrastructure and dashboard management features. Redesigned the moderation page with tabbed content for Events and Hackathons, implemented new API endpoints for fetching and approving/rejecting pending hackathons, created dashboard pages for creating and editing hackathons, and added supporting components and service logic for hackathon approval workflows.

Changes

Cohort / File(s) Summary
Moderation UI
app/admin/moderation/page.tsx
Restructured moderation page with tabbed interface (Events/Hackathons); replaced single queue with separate moderation components; split stats fetching into events and hackathons endpoints; updated header text to "Content Moderation".
Hackathon Moderation API
app/api/admin/moderation/hackathons/route.ts, app/api/admin/moderation/hackathons/[id]/route.ts
Added GET endpoint to fetch pending hackathons with pagination; added POST endpoint to approve/reject pending hackathons with optional rejection reasons; both endpoints enforce platform admin authorization.
Hackathon Management API
app/api/hackathons/[id]/route.ts, app/api/hackathons/[id]/submit/route.ts, app/api/hackathons/route.ts
Enhanced PUT/DELETE routes with authentication and authorization checks (admin or company member); added new submit endpoint to request hackathon approval; updated POST to accept optional company_id and improved authorization logic for non-admin users.
Company Hackathons API
app/api/companies/[slug]/hackathons/route.ts
Introduced authentication and membership verification; restricted non-member queries to approved hackathons only; replaced client-side caching with server-side membership checks.
Hackathon Dashboard Pages
app/dashboard/company/[slug]/hackathons/page.tsx, app/dashboard/company/[slug]/hackathons/create/page.tsx, app/dashboard/company/[slug]/hackathons/[hackathonSlug]/edit/page.tsx
Added three new pages: hackathon management dashboard with statistics and search, create hackathon form page, and edit hackathon page with deletion capability.
Hackathon Components
components/dashboard/HackathonForm.tsx, components/moderation/HackathonModerationQueue.tsx
Created reusable HackathonForm component supporting create/edit modes with multi-section form layout; created HackathonModerationQueue component for displaying and moderating pending hackathons with approval/rejection actions.
Hackathons Service
lib/services/hackathons.ts
Added default filtering to restrict queries to approved hackathons when approval_status is not explicitly specified; applied constraint to both standard and featured hackathon queries.

Sequence Diagrams

sequenceDiagram
    participant User as Admin User
    participant UI as Moderation UI
    participant API as API<br/>/admin/moderation/<br/>hackathons
    participant DB as Database

    User->>UI: View Hackathons Tab
    UI->>API: GET /api/admin/moderation/hackathons
    API->>DB: Query pending hackathons<br/>(approval_status = 'pending')
    DB-->>API: Return pending hackathons
    API-->>UI: Return paginated results
    UI->>UI: Render hackathon queue

    User->>UI: Click Approve/Reject
    UI->>UI: Show action dialog<br/>(with reason for reject)
    User->>UI: Confirm action
    UI->>API: POST /api/admin/moderation/<br/>hackathons/{id}
    Note over API: Validate authorization<br/>(platform admin)
    API->>DB: Update hackathon<br/>(approval_status, status,<br/>rejection_reason)
    DB-->>API: Success
    API-->>UI: Return updated hackathon
    UI->>UI: Refresh list & show toast
Loading
sequenceDiagram
    participant User as Company User
    participant UI as Dashboard
    participant CreateForm as HackathonForm
    participant PostAPI as POST /api/hackathons
    participant SubmitAPI as POST /api/hackathons/{id}/submit
    participant DB as Database

    User->>UI: Navigate to Create
    UI->>CreateForm: Render form (mode: create)
    User->>CreateForm: Fill form & submit
    CreateForm->>PostAPI: POST (hackathon data)
    PostAPI->>PostAPI: Verify user is admin<br/>or company member
    PostAPI->>DB: Insert hackathon<br/>(status: draft)
    DB-->>PostAPI: Return created hackathon
    PostAPI-->>CreateForm: Success response
    CreateForm->>SubmitAPI: POST /api/hackathons/{id}/submit
    SubmitAPI->>DB: Update status to pending<br/>(approval_status: pending)
    DB-->>SubmitAPI: Success
    SubmitAPI-->>CreateForm: Success response
    CreateForm->>UI: Trigger onSuccess callback
    UI->>UI: Navigate to hackathons list
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Areas requiring extra attention:

  • Authorization logic across multiple endpoints — Verify that admin checks, company membership validation, and access control are consistently applied across app/api/hackathons/route.ts, app/api/hackathons/[id]/route.ts, app/api/hackathons/[id]/submit/route.ts, and company-scoped routes.
  • Approval workflow state transitions — Review state transitions in app/api/hackathons/[id]/submit/route.ts and app/api/admin/moderation/hackathons/[id]/route.ts to ensure status and approval_status fields are updated correctly in both approve and reject scenarios.
  • HackathonModerationQueue — Complex component with pagination, moderation actions, and modal dialogs; verify error handling, loading states, and refresh logic after actions.
  • HackathonForm validation and API interaction — Ensure form validation covers all required fields, slug normalization is correct, and both create and edit modes handle failures gracefully.
  • Service layer filtering defaults — Confirm that lib/services/hackathons.ts approval_status filtering changes don't break existing functionality or create unintended access restrictions.

Possibly related PRs

No additional PRs with strong code-level connections were found in the provided search results.

Poem

🐰 A moderation tale unfolds,
With hackathons brave and bold,
Approve, reject, submit with care,
Dashboards tabbed—a pair, a pair!
Authorization guards the gate, 🏆
While forms and queues cooperate!

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

📜 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 2b5210b and 771abc3.

📒 Files selected for processing (13)
  • app/admin/moderation/page.tsx (3 hunks)
  • app/api/admin/moderation/hackathons/[id]/route.ts (1 hunks)
  • app/api/admin/moderation/hackathons/route.ts (1 hunks)
  • app/api/companies/[slug]/hackathons/route.ts (3 hunks)
  • app/api/hackathons/[id]/route.ts (3 hunks)
  • app/api/hackathons/[id]/submit/route.ts (1 hunks)
  • app/api/hackathons/route.ts (2 hunks)
  • app/dashboard/company/[slug]/hackathons/[hackathonSlug]/edit/page.tsx (1 hunks)
  • app/dashboard/company/[slug]/hackathons/create/page.tsx (1 hunks)
  • app/dashboard/company/[slug]/hackathons/page.tsx (1 hunks)
  • components/dashboard/HackathonForm.tsx (1 hunks)
  • components/moderation/HackathonModerationQueue.tsx (1 hunks)
  • lib/services/hackathons.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