Skip to content

Commit

Permalink
fix admin delete node
Browse files Browse the repository at this point in the history
  • Loading branch information
SheItoon committed Jan 4, 2024
1 parent f9eff38 commit 21f236a
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/routes/nodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,10 +371,10 @@ node_router.patch('/admin', authenticateTokenAdm, async (req, res) => {
* schema:
* type: object
* required:
* - name
* - id
* properties:
* name:
* type: string
* type: number
* responses:
* 200:
* description: Node successfully deleted
Expand All @@ -385,18 +385,16 @@ node_router.patch('/admin', authenticateTokenAdm, async (req, res) => {
*/
node_router.delete('/admin', authenticateTokenAdm, async (req, res) => {
try {
const nodeName = req.body.name;
const id = req.body.id;

await prisma.parkour_node.deleteMany({
where: {
nodeId: {
name: nodeName,
},
nodeId: id
},
});
const deletedNode = await prisma.nodes.delete({
where: {
name: nodeName,
id: id,
},
});

Expand Down

0 comments on commit 21f236a

Please sign in to comment.