feat: Implement file upload and management features in ProjectViewPage
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user