FIX - Delete Poll Calling itself Bug �

This commit is contained in:
Manik Maity
2024-11-10 15:44:02 +05:30
parent 8207767850
commit 439ba997ab
3 changed files with 25 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
import mongoose from "mongoose";
import { createPollByData, findPollById, findPollsByCreatorId } from "../repositories/poll.repo.js";
import { createPollByData, deletePollById, findPollById, findPollsByCreatorId } from "../repositories/poll.repo.js";
export async function createPollService(title, description, options, userId) {
try {
@@ -67,7 +67,7 @@ export async function deletePollService(pollId, user) {
message: "Unauthorized"
}
}
const deletedPoll = await deletePollService(pollId);
const deletedPoll = await deletePollById(pollId);
return deletedPoll;
}