Skip to content

Commit

Permalink
update challenge mutation to allow updating challenge details
Browse files Browse the repository at this point in the history
  • Loading branch information
scottchen98 committed Oct 19, 2024
1 parent a4995e5 commit bfb1a7a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions convex/challenges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,24 @@ export const createChallenge = mutation({
},
});

export const updateChallenge = mutation({
args: {
challengeId: v.id("challenges"),
name: v.string(),
description: v.string(),
repeat: v.array(v.string()),
unitType: v.string(),
unitValue: v.number(),
unit: v.string(),
recurrence: v.string(),
startDate: v.number(),
endDate: v.number(),
},
handler: async (ctx, { challengeId, ...args }) => {
await ctx.db.patch(challengeId, args);
},
});

export const deleteChallenge = mutation({
args: {
challengeId: v.id("challenges"),
Expand Down

0 comments on commit bfb1a7a

Please sign in to comment.