Skip to content

Commit 9f8f654

Browse files
committed
Add deletePoll
1 parent 8191604 commit 9f8f654

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/service/poll.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ export async function findPollForEmbedMessage(
7777
return await polls.findPollForEmbedMessage(embedMessage.id);
7878
}
7979

80+
export async function deletePoll(id: PollId) {
81+
return await polls.deletePoll(id);
82+
}
83+
8084
export async function countDelayedVote(
8185
poll: Poll,
8286
message: Message<true>,

src/storage/poll.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ export async function findPollForEmbedMessage(
182182
});
183183
}
184184

185+
export async function deletePoll(id: PollId, ctx = db()): Promise<Poll> {
186+
return ctx.deleteFrom("polls").where("id", "=", id).returningAll().executeTakeFirstOrThrow();
187+
}
188+
185189
export async function markPollAsEnded(pollId: PollId, ctx = db()): Promise<void> {
186190
await ctx
187191
.updateTable("polls")

0 commit comments

Comments
 (0)