This commit is contained in:
2026-05-07 23:18:34 +02:00
commit 07c58f23ab
39 changed files with 6044 additions and 0 deletions

20
backend/routes/user.js Normal file
View File

@@ -0,0 +1,20 @@
import jwt from 'jsonwebtoken'
import { prisma } from '../prisma.js'
export const deleteUser = async (req, res) => {
// Get user ID from url
const { userId } = req.params
try {
// Delete user from database
await prisma.user.delete({ where: { id: Number(userId) } })
// Return status and message
res.status(200).json({ message: 'User deleted' })
} catch (error) {
// If user not found, return error 404
res.status(404).json({ message: 'User not found' })
}
}