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(
|
.input(
|
||||||
z.object({ videoId: z.string(), delete_after_link_expires: z.boolean() })
|
z.object({ videoId: z.string(), delete_after_link_expires: z.boolean() })
|
||||||
)
|
)
|
||||||
.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: {
|
||||||
delete_after_link_expires: input.delete_after_link_expires,
|
delete_after_link_expires: input.delete_after_link_expires,
|
||||||
|
|
@ -216,6 +216,16 @@ export const videoRouter = createTRPCRouter({
|
||||||
throw new TRPCError({ code: "FORBIDDEN" });
|
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 {
|
return {
|
||||||
success: true,
|
success: true,
|
||||||
updateVideo,
|
updateVideo,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue