Skip to content

Commit

Permalink
fix: switch to use mutation and perform logging
Browse files Browse the repository at this point in the history
  • Loading branch information
dcshzj committed Aug 6, 2024
1 parent c9016dd commit de95e9b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion apps/studio/src/server/modules/asset/asset.router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { getFileKey, getPresignedPutUrl } from "./asset.service"
export const assetRouter = router({
getPresignedPutUrl: protectedProcedure
.input(getPresignedPutUrlSchema)
.query(async ({ input: { siteId, fileName } }) => {
.mutation(async ({ ctx, input: { siteId, fileName } }) => {
const fileKey = getFileKey({
siteId,
fileName,
Expand All @@ -15,6 +15,16 @@ export const assetRouter = router({
key: fileKey,
})

ctx.logger.info(
`Generated presigned PUT URL for ${fileKey} for site ${siteId}`,
{
userId: ctx.session?.userId,
siteId,
fileName,
fileKey,
},
)

return {
fileKey,
presignedPutUrl,
Expand Down

0 comments on commit de95e9b

Please sign in to comment.