Fix admin route access and backend configuration

- Added /admin redirect to login page in nginx config
- Fixed backend server.js route ordering for proper admin handling
- Updated authentication middleware and routes
- Added user management routes
- Configured PostgreSQL integration
- Updated environment configuration
This commit is contained in:
Local Server
2025-12-13 22:34:11 -06:00
parent 8bb6430a70
commit 703ab57984
253 changed files with 29870 additions and 157 deletions

View File

@@ -0,0 +1,71 @@
<!-- Sky Art Shop - ASP.NET Core CMS Project -->
# Copilot Instructions for Sky Art Shop
## Project Overview
Dynamic e-commerce CMS built with ASP.NET Core MVC 8.0, MongoDB for content, and ASP.NET Core Identity for authentication.
## Completed Tasks
- [x] ASP.NET Core MVC structure created
- [x] MongoDB integration (Products, Portfolio, Blog, Pages, Settings, MenuItems)
- [x] ASP.NET Core Identity + SQLite for authentication
- [x] Admin panel with CRUD for all content types
- [x] Public pages (Home, Shop, Portfolio, Blog, About, Contact)
- [x] CKEditor 5 rich text editor (no API key required)
- [x] Image upload service (wwwroot/uploads/images)
- [x] Dynamic navigation via ViewComponent
- [x] Seeding for default data (admin user, settings, categories, menus)
- [x] Clean build with zero errors
- [x] Application tested and running on http://localhost:5000
- [x] README documentation updated
## Architecture
- **Backend**: ASP.NET Core 8.0 MVC
- **Content DB**: MongoDB (connection string in appsettings.json)
- **Auth DB**: SQLite + EF Core + Identity
- **Admin Auth**: Role-based (Admin role)
- **Views**: Razor + Bootstrap 5 (admin) + custom CSS (public)
## Key Files
- `Program.cs`: Middleware, services, database initialization
- `Models/DatabaseModels.cs`: MongoDB entity models
- `Services/MongoDBService.cs`: Generic MongoDB CRUD service
- `Data/ApplicationDbContext.cs`: EF Core Identity context
- `Controllers/Admin*.cs`: Admin CRUD controllers ([Authorize(Roles="Admin")])
- `Controllers/*.cs`: Public controllers (Shop, Portfolio, Blog, About, Contact)
- `Views/Shared/_Layout.cshtml`: Public layout with dynamic navigation
- `Views/Shared/_AdminLayout.cshtml`: Admin dashboard layout
- `ViewComponents/NavigationViewComponent.cs`: Dynamic menu rendering
## Running the Project
```powershell
dotnet build # Build solution
dotnet run # Start on http://localhost:5000
```
## Admin Access
- URL: http://localhost:5000/admin/login
- Default: admin@skyartshop.com / Admin123! (configure in appsettings.json)
## Future Development Guidelines
- Use MongoDBService for all MongoDB operations
- Admin controllers must use [Authorize(Roles="Admin")]
- Slug generation: lowercase, replace spaces with hyphens
- TempData["SuccessMessage"] / TempData["ErrorMessage"] for user feedback
- Image uploads go to wwwroot/uploads/images with GUID filenames
- All views use Razor syntax; avoid direct HTML files
## Optional Enhancements
- Server-side validation (DataAnnotations)
- Email service for contact form
- Shopping cart/checkout
- SEO meta tags
- Centralized slug utility service