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,58 @@
@model List<SkyArtShop.Models.PortfolioProject>
@{
Layout = "~/Views/Shared/_AdminLayout.cshtml";
ViewData["Title"] = "Portfolio Projects";
var categories = ViewBag.Categories as List<SkyArtShop.Models.PortfolioCategory> ?? new();
var selected = ViewBag.SelectedCategory as string;
}
<div class="card mb-3">
<div class="card-body d-flex justify-content-between align-items-center">
<h5 class="mb-0">Projects</h5>
<a class="btn btn-primary" href="/admin/portfolio/project/create">Create Project</a>
</div>
</div>
<div class="card">
<div class="card-body">
<form method="get" class="row g-2 mb-3">
<div class="col-auto">
<select name="categoryId" class="form-select" onchange="this.form.submit()">
<option value="">All Categories</option>
@foreach (var c in categories)
{
<option value="@c.Id" selected="@(selected == c.Id ? "selected" : null)">@c.Name</option>
}
</select>
</div>
<div class="col-auto">
<a class="btn btn-secondary" href="/admin/portfolio/projects">Reset</a>
</div>
</form>
<table class="table table-striped">
<thead>
<tr>
<th>Title</th>
<th>Category</th>
<th>Order</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach (var p in Model)
{
var catName = categories.FirstOrDefault(c => c.Id == p.CategoryId)?.Name ?? "-";
<tr>
<td>@p.Title</td>
<td>@catName</td>
<td>@p.DisplayOrder</td>
<td>
<a class="btn btn-sm btn-secondary" href="/admin/portfolio/project/edit/@p.Id">Edit</a>
<form method="post" action="/admin/portfolio/project/delete/@p.Id" class="d-inline" onsubmit="return confirm('Delete this project?');">
<button class="btn btn-sm btn-danger" type="submit">Delete</button>
</form>
</td>
</tr>
}
</tbody>
</table>
</div>
</div>