fix: make gamification calls non-blocking so errors don't fail core mutations
awardPoints/checkAchievements were awaited inline, so any gamification error (DB constraint, missing table, etc.) would propagate as INTERNAL_SERVER_ERROR on comment creation, recording plays, etc. Now they run fire-and-forget with error logging, so the core action always succeeds. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -59,9 +59,10 @@ builder.mutationField("createCommentForVideo", (t) =>
|
||||
})
|
||||
.returning();
|
||||
|
||||
// Gamification
|
||||
await awardPoints(ctx.db, ctx.currentUser.id, "COMMENT_CREATE");
|
||||
await checkAchievements(ctx.db, ctx.currentUser.id, "social");
|
||||
// Gamification (non-blocking)
|
||||
awardPoints(ctx.db, ctx.currentUser.id, "COMMENT_CREATE")
|
||||
.then(() => checkAchievements(ctx.db, ctx.currentUser!.id, "social"))
|
||||
.catch((e) => console.error("Gamification error on comment:", e));
|
||||
|
||||
const user = await ctx.db
|
||||
.select({
|
||||
|
||||
Reference in New Issue
Block a user