Skip to content

Commit

Permalink
add: delete skillName
Browse files Browse the repository at this point in the history
  • Loading branch information
Celesca committed Nov 7, 2024
1 parent 898b2b6 commit 8a81c53
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/controllers/skillController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,27 @@ export const skillController = new Elysia({ prefix: "/skill" })
}
)

.delete(":skillName", async ({ params: { skillName }, error }) => {
const skill = await prisma.skills.findUnique({
where: { Skill_Name: skillName },
});

if (!skill) {
return error(404, "Skill not found");
}

await prisma.skills.delete({
where: { Skill_Name: skillName },
});

return { message: "Skill deleted successfully" };
}, {
params: t.Object({
skillName: t.String(),
}),
}
)

// Add skill to user
.post(
"/add-to-user",
Expand Down

0 comments on commit 8a81c53

Please sign in to comment.