feat: Implement file upload and management features in ProjectViewPage

This commit is contained in:
2025-09-24 21:55:44 +02:00
parent 0f451555d3
commit 96333ecced
7 changed files with 490 additions and 15 deletions

View File

@@ -4,8 +4,9 @@ import { withAdminAuth } from "@/lib/middleware/auth";
// GET: Get user by ID (admin only)
async function getUserHandler(req, { params }) {
const { id } = await params;
try {
const user = getUserById(params.id);
const user = getUserById(id);
if (!user) {
return NextResponse.json(
@@ -29,9 +30,10 @@ async function getUserHandler(req, { params }) {
// PUT: Update user (admin only)
async function updateUserHandler(req, { params }) {
const { id } = await params;
try {
const data = await req.json();
const userId = params.id;
const userId = id;
// Prevent admin from deactivating themselves
if (data.is_active === false && userId === req.user.id) {
@@ -92,8 +94,9 @@ async function updateUserHandler(req, { params }) {
// DELETE: Delete user (admin only)
async function deleteUserHandler(req, { params }) {
const { id } = await params;
try {
const userId = params.id;
const userId = id;
// Prevent admin from deleting themselves
if (userId === req.user.id) {