Skip to content

feat: admin auth, charts, backend service layer, frontend improvements#3

Open
AAYUSH412 wants to merge 1 commit intoLagadnakul:mainfrom
AAYUSH412:aayush/admin-fixes-and-improvements
Open

feat: admin auth, charts, backend service layer, frontend improvements#3
AAYUSH412 wants to merge 1 commit intoLagadnakul:mainfrom
AAYUSH412:aayush/admin-fixes-and-improvements

Conversation

@AAYUSH412
Copy link
Contributor

Admin Panel:

  • Fix .env.local syntax (VITE_API_URL was invalid JS expression)
  • Implement api.js, foodService.js, orderService.js (were empty)
  • Add AuthContext, ProtectedRoute, admin Login page
  • Add 3 live recharts: Revenue, Orders by Status, Category
  • Fix Navbar to show real admin name with working logout
  • Fix Orders double /api/ URL bug + POST->PATCH status update
  • Fix food image URLs (use ImageKit CDN, not localhost)
  • Fix 'Cannot access handleFileSelection before initialization' crash
  • Fix orders filter showing empty list with empty search term
  • Add Pending status support across Orders page

Backend:

  • Add isAdmin field to userModel
  • Add POST /user/admin/login endpoint (rejects non-admin with 403)
  • Add service layer (foodService, orderService, userService)
  • Add error-handler, logger, rate-limit middleware
  • Improve error handling across controllers

Frontend:

  • Centralize API calls through api.js service
  • Add 14 shadcn/ui components
  • Fix ESLint errors (motion imports, smart quotes in Contact.jsx)
  • Add useOrders custom hook
  • Fix AddressesPage to use api.js instead of raw axios

Docs:

  • Add DOCUMENTATION.md for admin, backend, frontend
  • Add CHANGES.md summarizing all changes

Admin Panel:
- Fix .env.local syntax (VITE_API_URL was invalid JS expression)
- Implement api.js, foodService.js, orderService.js (were empty)
- Add AuthContext, ProtectedRoute, admin Login page
- Add 3 live recharts: Revenue, Orders by Status, Category
- Fix Navbar to show real admin name with working logout
- Fix Orders double /api/ URL bug + POST->PATCH status update
- Fix food image URLs (use ImageKit CDN, not localhost)
- Fix 'Cannot access handleFileSelection before initialization' crash
- Fix orders filter showing empty list with empty search term
- Add Pending status support across Orders page

Backend:
- Add isAdmin field to userModel
- Add POST /user/admin/login endpoint (rejects non-admin with 403)
- Add service layer (foodService, orderService, userService)
- Add error-handler, logger, rate-limit middleware
- Improve error handling across controllers

Frontend:
- Centralize API calls through api.js service
- Add 14 shadcn/ui components
- Fix ESLint errors (motion imports, smart quotes in Contact.jsx)
- Add useOrders custom hook
- Fix AddressesPage to use api.js instead of raw axios

Docs:
- Add DOCUMENTATION.md for admin, backend, frontend
- Add CHANGES.md summarizing all changes
Copilot AI review requested due to automatic review settings February 25, 2026 17:59
@vercel
Copy link

vercel bot commented Feb 25, 2026

@AAYUSH412 is attempting to deploy a commit to the Nakul Lagad's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements a comprehensive admin authentication system, adds data visualization charts to the dashboard, introduces a service layer to the backend for better code organization, and includes numerous bug fixes and improvements across the admin panel and frontend.

Changes:

  • Added JWT-based admin authentication with login page, AuthContext, and protected routes
  • Implemented three live Recharts visualizations (Revenue, Orders by Status, Category distribution)
  • Created backend service layer (foodService, orderService, userService) and improved error handling
  • Fixed multiple critical bugs including incorrect API URLs, image loading issues, and filter logic

Reviewed changes

Copilot reviewed 117 out of 275 changed files in this pull request and generated no comments.

Show a summary per file
File Description
frontend/.agents/skills/ui-ux-pro-max/data/stacks/astro.csv Added Astro framework best practices guideline data
frontend/.agents/skills/ui-ux-pro-max/data/landing.csv Added landing page design pattern reference data
frontend/.agents/skills/ui-ux-pro-max/data/charts.csv Added chart type selection and accessibility guidelines
frontend/.agents/skills/shadcn-ui/references/learn.md Added shadcn/ui learning guide documentation
frontend/.agents/skills/shadcn-ui/references/chart.md Added shadcn/ui chart component reference
frontend/.agents/skills/find-skills/SKILL.md Added skill discovery system documentation
backend/vercel.json Removed hardcoded environment variables
backend/utils/errors.js Created custom error classes for better error handling
backend/services/userService.js Created user service layer with auth and profile logic
backend/services/orderService.js Created order service layer with validation
backend/services/foodService.js Created food service layer
backend/server.js Added middleware for logging, rate limiting, and error handling
backend/scripts/makeAdmin.js Created admin promotion script
backend/routes/userRoute.js Added admin login endpoint
backend/models/userModel.js Added isAdmin field to user schema
backend/middleware/* Added error handler, logger, and rate limiter middleware
backend/controllers/* Refactored to use service layer
admin/src/services/* Implemented all API service methods
admin/src/contexts/AuthContext.jsx Created admin authentication context
admin/src/components/ProtectedRoute.jsx Created route protection component
admin/src/components/Navbar/Navbar.jsx Fixed to show real admin name and working logout
admin/src/components/Charts/Charts.jsx Created three chart components
admin/src/pages/Login/Login.jsx Created admin login page
admin/src/pages/Orders/Orders.jsx Fixed API calls and added Pending status support
admin/src/pages/List/List.jsx Fixed image URLs to use ImageKit CDN
admin/src/pages/Add/Add.jsx Fixed initialization order bug
admin/src/App.jsx Added authentication routing
CHANGES.md Added comprehensive change log
Files not reviewed (2)
  • admin/package-lock.json: Language not supported
  • backend/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants