add update video shareLinkExpiresAt event
This commit is contained in:
parent
8f40b1279f
commit
fe2081bdea
1 changed files with 13 additions and 3 deletions
|
|
@ -238,11 +238,11 @@ export const videoRouter = createTRPCRouter({
|
||||||
shareLinkExpiresAt: z.nullable(z.date()),
|
shareLinkExpiresAt: z.nullable(z.date()),
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.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: {
|
||||||
shareLinkExpiresAt: input.shareLinkExpiresAt,
|
shareLinkExpiresAt: input.shareLinkExpiresAt,
|
||||||
|
|
@ -253,6 +253,16 @@ export const videoRouter = createTRPCRouter({
|
||||||
throw new TRPCError({ code: "FORBIDDEN" });
|
throw new TRPCError({ code: "FORBIDDEN" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
posthog.capture({
|
||||||
|
distinctId: session.user.id,
|
||||||
|
event: "update video shareLinkExpiresAt",
|
||||||
|
properties: {
|
||||||
|
videoId: input.videoId,
|
||||||
|
shareLinkExpiresAt: input.shareLinkExpiresAt,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
void posthog.shutdownAsync();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
success: true,
|
success: true,
|
||||||
updateVideo,
|
updateVideo,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue