add update video title event
This commit is contained in:
parent
fe2081bdea
commit
2fe910feec
1 changed files with 13 additions and 3 deletions
|
|
@ -275,11 +275,11 @@ export const videoRouter = createTRPCRouter({
|
||||||
title: z.string(),
|
title: z.string(),
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.mutation(async ({ ctx, input }) => {
|
.mutation(async ({ ctx: { prisma, session, posthog }, input }) => {
|
||||||
const updateVideo = await ctx.prisma.video.updateMany({
|
const updateVideo = await prisma.video.updateMany({
|
||||||
where: {
|
where: {
|
||||||
id: input.videoId,
|
id: input.videoId,
|
||||||
userId: ctx.session.user.id,
|
userId: session.user.id,
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
title: input.title,
|
title: input.title,
|
||||||
|
|
@ -290,6 +290,16 @@ export const videoRouter = createTRPCRouter({
|
||||||
throw new TRPCError({ code: "FORBIDDEN" });
|
throw new TRPCError({ code: "FORBIDDEN" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
posthog.capture({
|
||||||
|
distinctId: session.user.id,
|
||||||
|
event: "update video title",
|
||||||
|
properties: {
|
||||||
|
videoId: input.videoId,
|
||||||
|
title: input.title,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
void posthog.shutdownAsync();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
success: true,
|
success: true,
|
||||||
updateVideo,
|
updateVideo,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue