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