Skip to content

Commit

Permalink
chore: debug
Browse files Browse the repository at this point in the history
  • Loading branch information
qin-guan committed Jul 16, 2023
1 parent 1587e5b commit a939d97
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 3 additions & 1 deletion server/trpc/routers/me/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ export const meRouter = router({
get: protectedProcedure
.meta({ participants: true })
.query(async ({ ctx }) => {
if (await userStorage.hasItem(ctx.session.user.id))
if (await userStorage.hasItem(ctx.session.user.id)) {
console.log('cached')

Check failure on line 14 in server/trpc/routers/me/index.ts

View workflow job for this annotation

GitHub Actions / ci

Unexpected console statement
return await userStorage.getItem<User>(ctx.session.user.id)
}

const user = await ctx.prisma.user.findUniqueOrThrow({
where: { id: ctx.session.user.id },
Expand Down
12 changes: 12 additions & 0 deletions server/trpc/routers/survey/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,16 @@ export const surveyRouter = router({

return survey
}),

delete: protectedProcedure.input(
z.object({
id: z.string(),
}),
).mutation(async ({ ctx, input }) => {
await ctx.prisma.survey.delete({
where: { id: input.id },
})

await surveyStorage.removeItem(input.id)
}),
})

0 comments on commit a939d97

Please sign in to comment.