Skip to content

Commit

Permalink
Wrap DB calls in conversation.external
Browse files Browse the repository at this point in the history
  • Loading branch information
mUusitalo committed Feb 1, 2025
1 parent 4ba3c87 commit 3fec867
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/conversations/entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ export async function entry(
const enteredDistance = await distance(conversation, ctx, enteredSport);
const enteredImage = await image(conversation, ctx);

await saveEntry({
await conversation.external(() => saveEntry({
distance: enteredDistance,
sport: enteredSport,
doublePoints: false,
fileIds: enteredImage,
userId: ctx.chatId,
});
}));

await ctx.replyWithSticker(
STICKERS[Math.floor(Math.random() * STICKERS.length)],
Expand Down
4 changes: 2 additions & 2 deletions src/conversations/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ export async function register(
}
}

await prisma.user.create({
await conversation.external(() => prisma.user.create({
data: user,
});
}));

await ctx.reply(
`${REGISTRATION_SUCCESSFUL_MESSAGE}, ${
Expand Down

0 comments on commit 3fec867

Please sign in to comment.