Skip to content

Commit

Permalink
Add profileId to awardRouter mutation
Browse files Browse the repository at this point in the history
* Add profileId to awardRouter mutation
  • Loading branch information
byronwall committed Jan 8, 2024
1 parent 0e3808a commit 1a13a98
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/server/api/routers/awardRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,16 @@ export const awardRouter = createTRPCRouter({
imageId: z.string(),
})
)
.mutation(async ({ input }) => {
.mutation(async ({ ctx, input }) => {
const profileId = ctx.session.user.activeProfile.id;
let awardId = input.awardId;

// find first null award and assign imageId to it
if (!input.awardId) {
const award = await prisma.profileAward.findFirst({
where: {
imageId: null,
profileId: profileId,
},
});

Expand Down

0 comments on commit 1a13a98

Please sign in to comment.